How to force rigid body's callbacks invocated?

Mars

15-05-2007 04:36:30

The document said the world will detect which body doesnt move since last update and then ignore it next update time. But this make my camera move difficult, say, when I press W key, I add a velocity to it, and after I released the key, of course it shouldnt move any more. But then the world will think all things is ok, and skipped the callback, regardless of the velocities I have added. So is there some way to force these functions invocated? Or some other way I might do to inform the world that something have changed?

walaber

16-05-2007 04:51:13


body->setAutoFreeze( 0 );


this will force the body to stay "awake" and not fall "asleep" if it doesn't move.

Mars

16-05-2007 11:45:27

Thank you walaber,
I have tried your suggestion, but it doesnt make any change :( . After my app started, I can keep the camera's control for a little while, then it stucked at some point and refused to move forever. Exactly as before.
Would you tell me why?

Mars

16-05-2007 12:10:32

Let me make some more about it. The actual scenario is I control the camera's body to move towards any direction and if too far away(about 100 units or so), it got stuck. But if I keep it move only a little step, all things are ok. But that doesnt seem very good.
How do you think about this?
thanks in advance.

trilobite

18-05-2007 07:47:02

The "getting stuck" behavior you describe happens when your OgreNewt world is too small. The default size often is too small and you have to increase it.

Here is how I do it... (well, how others did it and I copied them :) )

// create the OgreNewt world. this must be done before any other commands can be called.
m_pNewtWorld = new OgreNewt::World();
// necessary to set, otherwise objects stick to invisible walls of small default size world
m_pNewtWorld->setWorldSize(Ogre::AxisAlignedBox(-30000,-10000,-30000,30000,30000,30000));

Mars

18-05-2007 11:27:36

Oh, really, really thank you.
Not only my camera, but also I was stuck for so many days. And, at last, you rescued me!