vector2. fromto ?

Ultrafop 4 years ago updated 3 years ago 1

Hey all,

I'm trying to get my player object to align with the ground (think Sonic the Hedgehog in the loops)

I'm currently Using Raycast2D to get a vector FromTo (transform.up, normal) and feed that into a rotate (FromTo angle, z axis). It work but very oddly. Basically my sprite does "flips" to the correct angle when moving to between different slopes. It often occurs moving left but will sometimes occur when moving right.

I gave already tried a few different methods to get this working but I'm at a loss. If someone has a  successful implementation of this in 2d I'd love to know how you did it :) (perhaps with a screencap and imgur??).

Thanks in advance for any help!

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):