- Home /
How do you turn object to face a particular vector ?
I am trying to solve a train orientation problem
it's on a track I want it to run parallel with track and turn it's forward direction accordingly.
I have posted images on the forum can anybody help
I have had help with the vectors (used ray cast to get hit.normal with rail) then used dot product (hit.normal ,up vector) to get parallel vector the issue is orientating train to this direction vector http://forum.unity3d.com/viewtopic.php?t=48762
Answer by duck · Apr 09, 2010 at 10:09 AM
To point an object towards a particular vector, use Transform.LookAt, like this:
transform.LookAt( targetDirectionVector );
Your answer
Follow this Question
Related Questions
How can I change the "forward" direction of my model? 5 Answers
how to calculate vector perpendicular to another and apply this to object direction? 2 Answers
Defining the forward for an arbitrary mesh 2 Answers
Creating Hint Vector 1 Answer
Get the sin of an angle between vector3.forward and direction character is moving 1 Answer