View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# 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.

2 replies to this topic

### #1Anonymous Poster_Anonymous Poster_*  Guests

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.

Leo.

### #2Alastair  Members

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.

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.