Jump to content
  • Advertisement
Sign in to follow this  
MrD 588

Crazy Camera

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

Hey all, I'm trying to make your standard, fly anywhere debug Camera in DirectX and have gotten a bit stuck. Essentially, all I want the Camera to do is be rotatable and then move in the direction it's facing. I was trying to implement the rotation part by rotating the eye vector around but I now have an interesting issue when rotating the Camera all the way around. I can't really explain it, so instead I made a video of it and uploaded it. All I am doing in that video is holding the button to rotate the Camera left. The code for rotating the Camera is shown below:
void Camera::rotateCamera(const D3DXVECTOR3 &rot)
{
	D3DXMATRIX rotMat;
	D3DXMatrixRotationYawPitchRoll(&rotMat, rot.x, rot.y, rot.z);
	D3DXVec3TransformCoord(&m_at, &m_at, &rotMat);

	m_cameraMoved = true;
}
As ever, any help is appreciated.

Share this post


Link to post
Share on other sites
Advertisement
A couple of things:

Which parameter in the YawPitchRoll call are you changing when you rotate the camera?

Assuming y is up and your rot vector is comprised of rotation angles in radians, the normal YawPitchRoll call would be:

D3DXMatrixRotationYawPitchRoll(&rotMat, rot.y, rot.x, rot.z );

Are you interpreting the angles in degrees and not radians? The video sort of suggests that. If you input rot.y = 45 and you think that's 45 degrees, it's really 45 radians and that's really 2500 degrees.

Share this post


Link to post
Share on other sites
Quote:
Original post by Buckeye
D3DXMatrixRotationYawPitchRoll(&rotMat, rot.y, rot.x, rot.z );
You would have thought so wouldn't you, but I'm passing in 0.01f in the X component of the vector, looks like my Yaw and Pitch got messed up somehow.

Thanks for that article MassacrerAL, the one you linked to was for Managed DirectX but I found the DirectX 9 one and took a look at that. It's a really nice description of how to setup a Camera.

[Edited by - MrDoom on February 17, 2008 9:09:02 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!