Archived

This topic is now archived and is closed to further replies.

How to align an object to a normal

This topic is 6033 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The following problem wont let me sleep I want to align an object to an surface-normal by calculating the angles for the rotations about the x and z axis. The y axis rotation is given by "object.rotation.y". (The object is a car and the "surface-normal" and a worldpos is calculated to rotate and position the car-mesh... ;-) Ps.: the y axis is "up"

Share this post


Link to post
Share on other sites
What you really want to do is align the up vector for the car to the normal vector for the landscape. You can do this using one rotation. You take the dot product of the up and normal vectors, and that gives you the cosine of the angle (amount) you need to rotate, and the cross product will give you a vector around which you will rotate to align them.



~BenDilts( void );

Share this post


Link to post
Share on other sites