x


How can I change the "forward" direction of my model?

in the car tutorial how can i change the forward vector for the car ? the complete scene setup the forward is pointing 45' degree to the track street i want the forward for the car to point always to the front of the car

this.transform.LookAt(this.transform.forward);

If i used the above code into the tutorial car it always look at 45' degree it doesnt look straight to the track road.

more ▼

asked Oct 23 '10 at 11:11 AM

Khm666 gravatar image

Khm666
11 2 2 3

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

1 answer: sort voted first

Sounds like your car has been modelled in your 3d modelling app with its origin (pivot) pointing in the wrong direction.

This is best fixed in the 3d app itself, although you can work around it by parenting your car model to an empty 3d game object. Then you can treat the empty game object as if it were the car (i.e. place scripts on it), and have the incorrectly aligned car model as a child, rotated to face the correct way.

more ▼

answered Oct 23 '10 at 12:53 PM

duck gravatar image

duck ♦♦
41.4k 95 152 415

i'm using the car from the tutorial itself the red one, the global forward for the car is 45' ! why is it like this ? the local is pointing toward the street but when i use the code above its not pointing toward the street !

Oct 23 '10 at 01:43 PM Khm666
(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:

x1330
x422
x296
x205
x108

asked: Oct 23 '10 at 11:11 AM

Seen: 2945 times

Last Updated: Oct 23 '10 at 12:54 PM