🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

rotating object 2 face point

Started by
0 comments, last by mutex 24 years, 5 months 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

Advertisement
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