how to lean an object smothly towards its moving direction by its velocity?
Hi everyone :) I'm working on a 2d side scrolling game in which i have a ufo, i want the ufo to lean smothly towards its move direction (only right and left) relative to the ufo's velocity in other words i want to change its rotation slowly towards the move direction as well as rotate back to 0 degrees(around the z axis) when the ufo is not moving. (i think that you can do it with lerp for the rotation, but i'm not sure).
i tried but couldn't do it so if someone knows how i would love to hear ,thanks! :) btw, im a beginer so forgive me for the weird questions sometimes xD
Look up how to do each part. Look up just how to smoothly rotate, then write something to tilt from 0 to 45 degrees (for example.) Test if you can go 0 to -45, or 45 to 0 (just have it start at 45 for that one.) See if you can have it spin up to 45 when you hold any key, then down to 0 when not.
Figuring out your speed depends on how you're making it move. Putting it together is computer program$$anonymous$$g. Learning how to use ifs and variables for tricks like this takes a while, and probably a decent book.
Answer by Orr10c · Oct 14, 2016 at 03:47 PM
ok thank you i will try agian <3 but if someone else succeeds i would love to hear!