Skip to main content
gamedev.net
🔒 Locked

Matrix Help Still

Started by MatthewEva 2 replies 400+ views
Original Post
MatthewEva
MatthewEva
Hi All, I got no responses from the last post I sent, and wondered if anyone anywhere knew of a method, or any links to any sites that can explain how I can obtain the rotations of the camera after I set the D3DXMATRIX* D3DXMatrixLookAtLH( function. I.e if I call the function D3DXMatrixLookAtLH( &D3DXVECTOR3(0.0f,10.0f,-10.0f), &D3DXVECTOR3(0.0f,0.0f,0.0f), &D3DXVECTOR3(0.0f,1.0f,0.0f)); I know from the coords given that the angle is roughly 45 degrees on the y axis (i.e. looking down or is it up 45 degrees) but there must be a method using one of the maths functions to calculate this. The matrix returned holds the transformed state, so im guessing that this may be the key, but im unsure which attributes in the matrix holds the rotations. maybe someone can help me with this. Thanks in advance #ifndef _DIRECTX PostQuitMessage(0); #endif
ifndef _DIRECTX PostQuitMessage(0);#endif
vImTo
vImTo
I thought as you know the position in 3D space of the camera, and the viewpoint before you set up the matrix with D3DXMatrixLookAtLH could you not use two basic right angle equations to work out the angle.

I feal this would be less work than trying to get an angle out of a D3DMatrix.

But my maths is not that hot. I can see it in my head
hope it helps :/

Gordon.

P|-|34R t|-|3 ||3//||3SS
JoeyBlow2
JoeyBlow2
atan2 using variables in the matrix...

That returns Radian which you can easily convert to degree.
MatthewEva
MatthewEva
Thanks guys,

Yes I could use a cos/sin calc on the two positions to calc the rotations, as the cam is not tilting Im not too worried about the z angle, only the x and y.



#ifndef _DIRECTX
PostQuitMessage(0);
#endif
ifndef _DIRECTX PostQuitMessage(0);#endif

Topic Locked

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

Sign in to reply to this topic.