• Advertisement


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

my camera is on drugs....

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

well, 2 days and the camera''s still load-high on extasy... as far as I know, D3D uses the left-handed cartersian coordinate system (z increases into the screen, x increases to the right and y increases up), but since my camera''s on drugs, it''s weird: the init part:
	{ // ----------
	} // ----------

	m_yaw_r	= m_pitch_r = m_roll_r	= 0;

	D3DXMatrixPerspectiveLH(&m_projection, 1.25f, 1.f, 1.f, 100.f);
	core::vid::device->SetTransform(D3DTS_PROJECTION, &m_projection);
void Camera::update()
	D3DXMatrixTranslation(&m_translation, m_position.x, m_position.y, m_position.z);
	D3DXMatrixRotationYawPitchRoll(&m_rotation, m_yaw_r, m_pitch_r, m_roll_r);
	{ // -----
		D3DXMatrixTranspose(&m_rotation, &m_rotation);
	} // -----

	D3DXMatrixMultiply(&m_camera, &m_translation, &m_rotation);
	D3DXMatrixTranspose(&m_rotation, &m_rotation);	

	m_strafe.x = 1.f; m_orientation.x = 0.f; m_heading.x = 0.f;
	m_strafe.y = 0.f; m_orientation.y = 1.f; m_heading.y = 0.f;
	m_strafe.z = 0.f; m_orientation.z = 0.f; m_heading.z = 1.f;
	D3DXVec3TransformCoord(&m_heading,		&m_heading,		&m_rotation);
	D3DXVec3TransformCoord(&m_orientation,	&m_orientation, &m_rotation);
	D3DXVec3TransformCoord(&m_strafe,		&m_strafe,		&m_rotation);
	core::vid::device->SetTransform(D3DTS_VIEW, &m_camera);
are there any noticeable errors here...?

Share this post

Link to post
Share on other sites
Geez making a camera in DirectX is so much easier than in GL thanks to the matrix functions...

Share this post

Link to post
Share on other sites

  • Advertisement