Jump to content
  • Advertisement

Archived

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

Bacardi34

Camera Orientation

This topic is 5673 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

Actually i have 2 questions. One, When i set up the camera, i set the look, up, eye point vectors, then use Microsofts CD3DCamera class and call SetViewParams(), like so.
  
	// init the camera

	D3DXVECTOR3 vLookAt, vEyePt, vUpVec;
	vLookAt = D3DXVECTOR3( 10.0, 0.09f, 0.0 );
	vEyePt	= D3DXVECTOR3( 0.0, 0.09f, 0.0 );
	vUpVec	= D3DXVECTOR3( 0.0, 1.0, 0.0 );
	g_Camera.SetViewParams( vEyePt, vLookAt, vUpVec );
	g_Camera.SetProjParams( 45.0f, SCREENWIDTH / SCREENHEIGHT, 0.1f, 500.0f );
  
But when my game starts, the camera seems to always be oriented the same way every time. Here is the code for SetViewParams
  
VOID CD3DCamera::SetViewParams( D3DXVECTOR3 &vEyePt, D3DXVECTOR3& vLookatPt,
                                D3DXVECTOR3& vUpVec )
{
    // Set attributes for the view matrix

    m_vEyePt    = vEyePt;
    m_vLookatPt = vLookatPt;
    m_vUpVec    = vUpVec;
    D3DXVECTOR3 vDir = m_vLookatPt - m_vEyePt;
    D3DXVec3Normalize( &m_vView, &vDir );
    D3DXVec3Cross( &m_vCross, &m_vView, &m_vUpVec );

    D3DXMatrixLookAtLH( &m_matView, &m_vEyePt, &m_vLookatPt, &m_vUpVec );
    D3DXMatrixInverse( &m_matBillboard, NULL, &m_matView );
    m_matBillboard._41 = 0.0f;
    m_matBillboard._42 = 0.0f;
    m_matBillboard._43 = 0.0f;
}
  
I have tried not using the SetViewParams function, but the same thing keeps happening. The camera seems to look down the Negative Z axis when the game starts, but then i can move the camera about freely. I can change the Z position of the camera, with the eyePt Vector, no matter what i change, the look vector is always the same. Two, when the camera moves, i have a viewMat and positionMat and i need to extract the eye Point of the camera so i can move/orient a weapon for a first person view. In the position mat is the xyz coords of the eyept positionMat._14 ._24 and ._34? Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!