Skip to main content
GameDev.net gamedev.net
🔒 Locked

Camera Track

Started by jeppa Nov 13, 2001 at 11:58 AM 0 replies 400+ views
Original Post
jeppa
jeppa
how I can track an object in motion ?? Thanks in Advance
invective
invective
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.