How can I make an object face a certain direction?
I have an object at x,y,z and I want it to point toward another object in space at x2,y2,z2. Is there an easy way to do this in the vertex shader?
Yes but you will probably need to pass either the rotation matrix or the object center and lookat point as uniforms to the shader (so you can calculate the rotation matrix). Then you multiple each vertex position by this matrix prior to the usually projection-viewmodel matrix multiply.
How do I calculate the rotation matrix?
gluLookAt() is one option.
Originally Posted by Rakehell