I'd like to develop a 3rd person camera which is always looking at the character's backside, with the camera's "up" and the characters "up" always in the same direction, even when the character is upsidedown on the upper prat of the hoop.
Developing a camera for this has got me stuck for over a week though. At first I started with the standard 3rd person camera as described in the Ogre tutorials, which uses a single camera node. I think the problem that I had there was gimbal lock, as the camera would always roll over on its own no matter what I tried.
Now I'm trying to use a multi-node camera in the hope that keeping the yaw, pitch, roll separate will help. But I can never get the camera to follow the character as he runs around the hoop--it always starts shuddering and pointing in random directions.
Setup code:
Code: Select all
mCameraNode = mSceneManager->getRootSceneNode()->createChildSceneNode();
mCameraYawNode = mCameraNode->createChildSceneNode();
mCameraPitchNode = mCameraYawNode->createChildSceneNode();
mCameraRollNode = mCameraPitchNode->createChildSceneNode();
mCameraYawNode->setFixedYawAxis(true);
mCameraNode->setFixedYawAxis(true);
mCameraPitchNode->setFixedYawAxis(true);
mCameraRollNode->attachObject(cam);