Rscorpiox
19-07-2009 15:52:24
I got a wierd camera view when I update the Newton world by calling update myself.
Here's my code:
I made the camera move around the body , and the character's body face the same way as camera.
Just like the usual 3rd person view game.
It's normal when camera stay just behind the body , rotating is all works just fine.
But when my camera on the top of my body , the wierd view shows up.
When camera at the back-upside of the body , and rotating to some direction.
The view just deformed like the video here:
http://www.chu.edu.tw/~b09402209/OgreNewt.avi
I've checked the position of camera , the body and camera's distance is the same as the camera behind body.
Don't know if this cause by OgreNewt.
But the status shows up after I update Newton world myself.
Hope somebody can give me some advice , or help.
Thanks for the reading .
Here's my code:
/*Update the Newton world*/
m_World->update(evt.timeSinceLastFrame);
/*Setting the camera's position and direction*/
Vector3 pos;
Ogre::Quaternion ori;
body->getPositionOrientation(pos,ori);
camPos.x = pos.x + radius*cos(...
camPos.z = pos.z + radius*cos(...
camPos.y = pos.y + radius*sin(...
mCamNode ->setPosition(camPos);
Cam->lookAt(Vector3(pos.x,pos.y+2,pos.z));
/*Setting the body has the same direction with camera*/
Ogre::Quaternion dir = Cam->getOrientation();
dir.x=0;
dir.z=0;
body->setPositionOrientation(pos,dir);
I made the camera move around the body , and the character's body face the same way as camera.
Just like the usual 3rd person view game.
It's normal when camera stay just behind the body , rotating is all works just fine.
But when my camera on the top of my body , the wierd view shows up.
When camera at the back-upside of the body , and rotating to some direction.
The view just deformed like the video here:
http://www.chu.edu.tw/~b09402209/OgreNewt.avi
I've checked the position of camera , the body and camera's distance is the same as the camera behind body.
Don't know if this cause by OgreNewt.
But the status shows up after I update Newton world myself.
Hope somebody can give me some advice , or help.
Thanks for the reading .