x


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

more ▼

asked Apr 09 '10 at 10:04 AM

dmaxwell gravatar image

dmaxwell
137 16 17 24

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

To point an object towards a particular vector, use Transform.LookAt, like this:

transform.LookAt( targetDirectionVector );
more ▼

answered Apr 09 '10 at 10:09 AM

duck gravatar image

duck ♦♦
40.9k 92 148 415

thanks for your help I will try it

Apr 09 '10 at 01:48 PM dmaxwell
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x285
x195
x101
x36
x13

asked: Apr 09 '10 at 10:04 AM

Seen: 2811 times

Last Updated: Apr 09 '10 at 10:04 AM