How do I rotate a 2D rigidbody along its trajectory?
obj.rotation = Quaterion.LookRotation (obj.velocity) doesn’t work that way.
How do I rotate a 2D rigidbody along its trajectory?
obj.rotation = Quaterion.LookRotation (obj.velocity) doesn’t work that way.
Ehm. It’s 2D. ![]()
Why do I recieve a error then?
Cannot implicitly convert type UnityEngine.Quaternion' to float’
Oh, I get it. Had to write obj.transform.rotation instead of just obj.rotation
Though the object disappears now for some reason. What am I doing wrong? ![]()
Well, it’s 2D. ![]()
The only axis you can rotate a 2D object around is the one that is perpendicular to the x/y axis. That’s usually z.
“rotate along its trajectory” would be rotating it around its x or y axis.
Or is this request just about rotating a 2D object to the direction that it moves to?
Yep, it is.
Oh, ok. Pardon! I guess this post describes what you’re looking for.