Problem of object's movement

steph31

14-12-2008 12:58:38

Hello everyone !
I ‘ve got a problem concerning the movement of objects, the function ‘addForce' (or AddTorque) doesn’t work...

Code to create the object :

World *mWorld = new World("log:html");
mScene =mWorld->createScene("Main","gravity: yes, floor: yes, renderer: ogre, rendererUserData: mSceneMgr");
mCube = mScene->createBody("tuto_cube", new Cube(Vector3(1.0f,1.0f,1.0f)), Vector3(0, 30, 0),"model: cube.1m.smooth.mesh", "mass: 10");


and the code for the movements of the created object:


if (mKeyboard->isKeyDown(OIS::KC_U) )mCube->addForce(Ogre::Vector3(0,20,0));


The object displays without problem in the window (and so I don’t have any mistakes in compilation).
I’m using Ogre 1.6 et NxOgre 1.0.21

Thanks in advance for answering to me.

spacegaier

14-12-2008 14:37:52

Try one of the following:

1. Your force is probably to low to overcome gravity and refriction -> try to set it up to huge numbers for testing.

2. You could also change the Force mode (it's the second parameter of addForce() if I remember correctly). Set it to Impulse for example.