# Free-Space-Camera rotation

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

## Recommended Posts

Hi, I want to create a camera like in the games "Descent" or "Forsaken". You can rotate freely in every direction. But each rotation is depending on the current camera state. Which means, it is not the same if you first rotate 90 degrees up and then 90 degrees to the left or if you first rotate left and then up. After the first way of rotating the camera would face to the left, but the floor of the world is to the viewers left on the screen. After the second way of rotating the camera would face upwards. It's like rotating your head to the left and then looking up instead of first looking upwards and then just rotate it to the left. It's not easy to describe what exactly I mean, but I hope you can imagine what I want. Hope you understand it or someone can describe it better than me :(

##### Share on other sites
So you got 3 vectors:

(doesnt have to start like this, dont matter at all)
_right (1,0,0)
_up (0,1,0)
_look (0,0,1)

You look left, you rotate around the y-angle then D3DXVec3Cross() the other two angles

D3DXVec3TransformCoord(&_right, &_right, &mRotation);
D3DXVec3TransformCoord(&_look , &_look , &mRotation);
// ... normalize etc ...

Assuming you rotated 90 degrees on the y-axis, your _right vector should now be on the z-axis instead of the x-axis.

1. 1
2. 2
Rutin
17
3. 3
4. 4
5. 5

• 26
• 10
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
633717
• Total Posts
3013510
×