Archived

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

Guest Anonymous Poster

Look at point in 3d

This topic is 6619 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You need to do some linear algebra! If you don't want to do the math, and you're using DirectX 7, the new utility library has this function.

D3DXMATRIX* D3DXMatrixLookAt(
D3DXMATRIX* pOut,
const D3DXVECTOR3* pEye,
const D3DXVECTOR3* pAt,
const D3DXVECTOR3* pUp
);

It builds a matrix that will rotate an object at the "pEye" point to look at the "pAt" point. "pUp" is, I think probably (the docs don't actually say :-), a rotation axis.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

Hi,

I want to make a character that look to a point (x,y,z). Like Tombraider and Grim Fandango.
And if I move the point, the character move his/her head always looking the point.
Is there some code or ideas about it.

Thanks in advance.

Leo.

Share this post


Link to post
Share on other sites
pUp is the relative "up" axis of the object. For example, as you are reading this on your computer screen, your "up" axis is pointing against the direction of gravity. On the other hand, if for some reason you tilt your head to the right, then your "up" axis is now different.

I didn't do the greatest job of explaining, but it should be enough for you to figure it out. :-)

Share this post


Link to post
Share on other sites