applying forces on a rigid body

bkatous

12-03-2011 00:54:40

hello,

i'm having some trouble trying to move a body. The code is very simple, im using the method applyForce.

bool MainApplication::frameRenderingQueued(const Ogre::FrameEvent& evt)
{
robotBody->applyForce(mRobotForce, robotGravityCenter); // bouger

return BaseApplication::frameRenderingQueued(evt);
}



bool MainApplication::keyPressed( const OIS::KeyEvent &arg )
{
if(arg.key == OIS::KC_NUMPAD8)
{
OutputDebugString("UP\n");
mRobotForce = gMaxRobotForce;
}
else if(arg.key == OIS::KC_NUMPAD2)
{
OutputDebugString("DOWN\n");
mRobotForce = -gMaxRobotForce;
}

return BaseApplication::keyPressed(arg);
}


it doesn't work, but when i use robotBody->applyForce(Ogre::Vector3(0, 0, -10), robotGravityCenter); i see the body moving.
maybe there is other ways to move the body, so please any help or suggestion would be appreciated.

Regards.