Question: Regarding the UpVector

Markness

07-09-2006 22:44:06

Heyas all,

Im having a few dramas keeping my character upright as they run across objects. I have searched and read all that I can find on this topic but none of the found suggestions seem to work.

Heres my situation. Im using OgreNewt primarily for collision, so the exact physics is not so much an issue - i just want to keep the character out of the walls.

At the moment im simply using the setVelocity() function to move the character around.

Heres the code


GetSceneNode()->yaw( Ogre::Radian( Input::getMouseDeltaX() )*-2.0f); // Access the object scene node and change orientation
Ogre::Vector3 CurPos;
Ogre::Quaternion CurOrien;
GetBody()->getPositionOrientation( CurPos, CurOrien ); // Retrieve phys objects pos / orientation
CurOrien = GetSceneNode()->getOrientation();
if( Input::isKeyDown( W ) ) {
GetBody()->setVelocity( GetSceneNode()->getOrientation() * Ogre::Vector3( 0.0F, 0.0F, 15.0F ) ); // Set velocity in the scene node's direction
}
GetBody()->setPositionOrientation( CurPos, CurOrien ); // Force the physics object's orientation


Also, i have set a UNIT_Y UpVector on the body as well.

Any suggestions? :D

Markness

08-09-2006 02:11:38

I seem to have got it working, the unfortunate thing is that i have to recreate the UpVector every update... is this normal?

Also the character moves along the ground VERY 'bumpily' :p