What is the easiest way to orient an object to face its velocity vector? If I have a rocket, and a force is fairly frequently changing it’s direction, how do I orient the direction of the rocket to face this vector?
I tried this:
transform.rotation = Quaternion.LookRotation(-rigidbody.velocity);
But it just kind of freaked out at me. Any suggestions?
Well doing that would be easy, but it’s more intuitive to actually rotate your rocket and have the velocity vector move with it.
Like rigidbody.velocity = transform.TransformDirection(0,0,speed);
then to make the rocket turn, transform.Rotate();
^That’s all assuming you’re new and wondering how the difference between global and local coordinates
I've read on the documentation and gone through google but my question is in terms of coding, when do I use this? When do I need to worry about this? Such as if I'm using mouse look script, and i shoot, it dosen't shoot from whre the mouse is...
But in the occasion that you need the system to work the way you have it try,
Quaternion.Euler(rigidbody.velocity);
if you have ANY questions at all. Please DON’T hesitate to PM me on the forums. Hope this helps, Good luck mate!