It's not moving

redhead

26-06-2008 15:57:00

Hi,
I tried to integrate OgreNewt to my project, I did everything like in demos, but it does nothing.

What I have to care about in setting up world?

I created world.
New mesh, mesh scene node, collision, body (set mass, that callback for gravity, moment of innertia, attached to node), and then in frame listener's frameStarted method caled mWorld->update()

In the first try, mesh moved, hower in very ugly way, and then suddenly stopped moving somewhere about y = 0 (i have no floor)

Second try, I created floor and more complex mesh. But it doesnt move, neither additional forces (like velocity) did nothing.

What am I doing wrong?

thanx

nord666

26-06-2008 16:23:18

Hello,

1) The wolrd isn't infinite. I think the default size is 200, 200, 200. Use the function:
mWorld->setWorldSize(Ogre::AxisAlignedBox(-500, 0, -500, 500, 110, 500));
Here my world is (1000, 110, 1000) at the position (0, 55, 0).

2) You should use the BasicFrameListener already made for the world update.
OgreNewt::BasicFrameListener * mOgreNewtListener = new OgreNewt::BasicFrameListener(mRoot->getAutoCreatedWindow(), mSceneMgr, mWorld, 120);
mRoot->addFrameListener(mOgreNewtListener);


3) To set gravity, use the already made callback function setStandardForceCallback() for each body you want gravity.

4) To move an object you have to use callback function.
//Near you body declaration
body->setCustomForceAndTorqueCallback(myCallBackFunction);

//Somewhere else
void myCallBackFunction(OgreNewt::Body * _body)
{
body->addForce(Ogre::Vector3(100, 0, 0));
//You can put the CallBack only function made for body here.
}


5) With OgreNewt, you can't move the mesh by only moving the SceneNode. You just have to move the body.

It's all! I hope I was useful.

netsurferj

27-06-2008 17:06:53

Hi

I used the FPPCamera example in the following post in my project:
http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=2110&highlight=first+person+camera
But the callback method never gets called? (When I add breakpoints anyplace in this method) so my camera just stands still? I added the methods in my frame listeners as stated on this post, but nothing helps.