2DPlatformer-Tutorial
2DPlatformer-Tutorial copied to clipboard
Can I rotate player follow ground?

Are you trying to make the player sprite rotate to match the ground, a la Sonic? That's pretty simple:
- Put the sprite in its own game object.
- Have some component that has a reference to the sprite object's Transform. This can be the Player script, or it could be some other script. For the sake of organization and reuse, I'd create a new component to do this, but that's just one option.
- In this component's Update method, have it get the angle of the slope (from collisions.slopeNormal) and write that value over the sprite Transform's eulerAngles.z.
- Some extra work will probably be needed to get the sprite to stop floating above slopes with higher angles.