[SOLVED] Object does not move after a period of time

Fred_FS
Posts: 10
Joined: Sun Sep 27, 2009 9:56 am

[SOLVED] Object does not move after a period of time

Post by Fred_FS »

I have a strange problem. If I am moving my object all the time, everything works well.
But if I don't move my object for a short period of time, it seems to be sticking in the other objects and is not movable anymore.
But now I tried to disable gravity and disable the collision response and I still got the same problem.
So do you know, what could be wrong with it?

Here some code:

Code: Select all

// update the physics world
physics_world_->stepSimulation( game_env_.render_time, 10);

Code: Select all

// move the player
		force_.normalise();
		rolling_force_.normalise();

		force_ *= force_strength_ * game_env_.render_time;
		rolling_force_ *= force_strength_ * game_env_.render_time;

		body_->applyCentralForce( BtOgre::Convert::toBullet(force_) );
		body_->applyTorque( BtOgre::Convert::toBullet( rolling_force_ ) ); 

		force_ = Ogre::Vector3::ZERO;
		rolling_force_ = Ogre::Vector3::ZERO;

		need_update_ = false;
I really hope you can help me, because I do not know what could be wrong.
Last edited by Fred_FS on Sat Oct 10, 2009 8:38 pm, edited 1 time in total.
nigul
Posts: 12
Joined: Tue Sep 22, 2009 1:40 pm

Re: Object does not move after a period of time

Post by nigul »

Hello,

maybe you could try to disable deactivation for your objects. Objects are indeed deactivated after a certain amount of time with no interaction (from what I understood from Bullet).

just try this :

body_->setActivationState(DISABLE_DEACTIVATION);

when creating your object.
Fred_FS
Posts: 10
Joined: Sun Sep 27, 2009 9:56 am

Re: Object does not move after a period of time

Post by Fred_FS »

Ah thank you! Now it's working.