Jump to content

  • Log In with Google      Sign In   
  • Create Account


Look at point in 3d


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 01 November 1999 - 01:08 PM


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.



Sponsor:

#2 Alastair   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 November 1999 - 09:29 AM

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.


#3 Kyle Radue   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 November 1999 - 01:08 PM

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. :-)





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS