Getting a 2D object to face the direction of its velocity relative to other objects in the level
Hullo, I'm basically making my own version of flappy bird for a mini game for a real life event I'm putting on, as well as practice. Everything is basically set up at this point, but for some additional flare I thought I'd try making the player's sprite rotate relative to the direction it looks like it's headed, similar to what flappy bird does (the bird's nose is up when you tell it to jump, and tilts downwards as it falls towards the ground).
I've realized this would be quite easy to do if the player's sprite was moving forward, but to avoid having to attach the camera to the sprite I used the ole' infinite runner trick of having the level move and the player stay still. I know that if he was moving I could use
transform.rotation = Quaternion.LookRotation(rb.velocity, Vector2.up);
but as it is he vanishes whenever he's moving at any speed, for some reason, and currently his only speeds are up and down. So I need to figure out a way to either change his rotation relative to the incoming walls or constrain his rotation to 45 degrees up and down.
Thanks!