Advertisement

rotating object 2 face point

Started by January 25, 2000 08:50 PM
0 comments, last by mutex 25 years, 1 month ago
Does anyone know how to generate a matrix that will rotate an object so that it faces a point? I know which way the object is pointing already, the origin of the object, and the location of the point (duh). Example would be to rotate heads so that they look at something. Another question I have is does anyone know how to generate a matrix that will rotate a normal so that it matches up with another normal? This is for rotating triangles so that they lay flat on another triangle (for use with blood spots and stains). Thanks in advance! http://members.xoom.com/mutex0

I can''t give you the matrix offhand, but atan2() is the C function to calculate the angle. atan2(y,x) returns the angle of something at that point from the origin. With points x1, y1 and x2, y2 you just get atan2(y2 - y1, x2 - x1) to get the angle from point x1, y1.

Hopefully you can throw that angle into the matrix.
-the logistical one-http://members.bellatlantic.net/~olsongt

This topic is closed to new replies.

Advertisement