Archived

This topic is now archived and is closed to further replies.

jeppa

Camera Track

Recommended Posts

if you are using direct 3d, use the D3DXMatrixLookAtLH function to generate a view matrix that pints at the coordinates of the moving object ear frame. If not, here is the documentation for the function so you can make your own (note this is left handed):

  
D3DXMATRIX* D3DXMatrixLookAtLH(
D3DXMATRIX* pOut,
CONST D3DXVECTOR3* pEye,
CONST D3DXVECTOR3* pAt,
CONST D3DXVECTOR3* pUp
);

zaxis = normal(At - Eye)
xaxis = normal(cross(Up, zaxis))
yaxis = cross(zaxis, xaxis)

xaxis.x yaxis.x zaxis.x 0
xaxis.y yaxis.y zaxis.y 0
xaxis.z yaxis.z zaxis.z 0
-dot(xaxis, eye) -dot(yaxis, eye) -dot(zaxis, eye) 1

Share this post


Link to post
Share on other sites