Having problems moving Body; New to NxOgre, but not to Ogre

l5games

05-03-2008 21:21:31

How should I move the body and the sceneNode?

I am under the assumption that translating the Body->getNode() will update the body in the simulation and the world.

Will the following move the body and the node?


Body->getNode()->translate(body->getNode()->getOrientation() * Vector3(0, 0, 1) * timePassed))


If I use the above code, the mesh moves around, but will not collide with anything.

I have been working with Ogre for a while now and had a fully running demo with it, but I wanted to add Physics and it just doesn't seem to be as straight forward as I thought it would be.

I am at an inpass. If someone has some code they wouldn't mind sharing, that would be awesome. I learn best by reading others code.


Any information, code snippets, etc... would be greatly appreciated.


Thanks,

betajaen

05-03-2008 21:50:05

You don't move the node, you move the body. If you move the node, NxOgre will move it back where it was.

l5games

06-03-2008 05:41:24

Should I use Body->setGlobalPosition, Body->moveGlobalPosition, Body->moveTowards? Which is the best way to move the Body and move the associated SceneNode the Body contains? If you could give an example, it would be much appreciated.

betajaen

06-03-2008 10:32:45

You move it around like you move things in reality - you add forces. You can use setGlobalPosition/Orientation if you wish, but only for big jumps or initial placement.