Welcome to the forums @"Justin Todd"
If you have a Vector2 for movement, then you can convert it to rotation using cos
and sin
:
var velocity_norm = velocity.normalized()
rotation = cos(velocity_norm.x) + sin(velocity_norm.y)
Edit: Sorry, not cos
and sin
, you need to use Atan2:
var velocity_norm = velocity.normalized()
rotation = atan2(velocity_norm.y, velocity_norm.x)
I don't know what I was thinking with my original post. You can use cos
and sin
to convert a angle to a vector, but that's not what you are looking for (nor what the code I originally wrote would do) :sweat_smile: