![](smile.gif)
How to align an object to a normal
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"
![](smile.gif)
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 );
~BenDilts( void );
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement