I have a object that travels from point a to point b. I was using transform.LookAt() and then transform.forward to get the correct direction to move the object in the desired direction.
Now I need to rotate that object, but keep it always moving in the same direction. Obviously when the object rotates it constantly has a new transform.forward which is no longer the desired direction I want it to travel.
So what I was thinking is i could take the transform.forward of the object before it starts rotating, then convert that vector3 into a world vector instead of local. Then the object can move in the correct direction based on world coordinates instead of local coordinates while it’s rotating.
Will this work? How would I conver the local vector into a world vector? (i tried TransformDirection and it didn’t seem to work). Is there a better way of getting an object to move in a specific direction while it rotates? How?
Jessy
2
Transform.forward is in world space. Just store that Vector3 before you rotate the object.