ViewMatrix and Camera Direction
by William Todd Scott · in Torque Game Engine · 01/24/2006 (2:05 pm) · 3 replies
Hi All,
I am trying to get the direction vector of the camera in the renderObject function of a class that inherits from SceneObject.
I believe that in DirectX this would normally be the third column of the viewMatrix and in OpenGL this would normally be the third row of the viewMatrix. However, the values I am pulling from the third row (and column) of the state->mViewMatrix don't seem to be correct.
Can someone help me out on what I am doing wrong?
Thanks
Todd
edit: Alternatively, is there a quick way to get the view direction of the camera from within the renderObject function?
I am trying to get the direction vector of the camera in the renderObject function of a class that inherits from SceneObject.
I believe that in DirectX this would normally be the third column of the viewMatrix and in OpenGL this would normally be the third row of the viewMatrix. However, the values I am pulling from the third row (and column) of the state->mViewMatrix don't seem to be correct.
Can someone help me out on what I am doing wrong?
Thanks
Todd
edit: Alternatively, is there a quick way to get the view direction of the camera from within the renderObject function?
#2
Thank you soooooo much. I can't tell you how much time I wasted on this, but with your help my stuff is working now.
I guess I never quite understood just how the viewMatrix would be effected by changin Z to up. I'm going to have to get some more linear algebra under my belt.
Thanks again.
Todd
01/24/2006 (2:41 pm)
Badguy,Thank you soooooo much. I can't tell you how much time I wasted on this, but with your help my stuff is working now.
I guess I never quite understood just how the viewMatrix would be effected by changin Z to up. I'm going to have to get some more linear algebra under my belt.
Thanks again.
Todd
Torque Owner Badguy
and apply the rotation from this matrix to it.
PointF heading(0,1,0) ; // cannot remember if this is right for torque
mat.mulv(heading); // something like that anyhow.