Third-person camera pitch and yaw
Posted: Wed Jan 26, 2005 3:45 pm
I'm looking for some help with my third person camera that I'm implementing. I've built the camera system up as specified elsewhere in the forum:
R
|
A --- T
|
B --- C
Where R is RootNode, A and B are SceneNodes, T is the Target (Avatar) and C is the Camera.
The B can be yawed, so that the camera turns around the avatar, while still looking at it. Likewise it can be pitched up and down too. The trouble comes when doing both of these movements together. The camera moves unpredictably, and is difficult to control. The code is like this:
what i end up with is this

Any help would be greatly appreciated.
P.S. I'm using BSPs so the Z axis is vertical, not the Y.
R
|
A --- T
|
B --- C
Where R is RootNode, A and B are SceneNodes, T is the Target (Avatar) and C is the Camera.
The B can be yawed, so that the camera turns around the avatar, while still looking at it. Likewise it can be pitched up and down too. The trouble comes when doing both of these movements together. The camera moves unpredictably, and is difficult to control. The code is like this:
Code: Select all
mRotX = Degree(-mInputDevice->getMouseRelativeX() * 0.13);
mRotY = Degree(-mInputDevice->getMouseRelativeY() * 0.13);
mCamNode->pitch(mRotY,Node::TS_PARENT);
mCamNode->yaw(mRotX,Node::TS_PARENT);

Any help would be greatly appreciated.
P.S. I'm using BSPs so the Z axis is vertical, not the Y.