# Crazy Camera

This topic is 3895 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
if i were you i would begin with camera from scratch. this might help.

##### Share on other sites
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 on other sites
Quote:
 Original post by BuckeyeD3DXMatrixRotationYawPitchRoll(&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]

1. 1
2. 2
3. 3
Rutin
18
4. 4
5. 5

• 13
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
632926
• Total Posts
3009239
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

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!