rigidbodies activation state

fordprefect
Posts: 2
Joined: Thu Apr 15, 2010 5:53 pm

rigidbodies activation state

Post by fordprefect »

I'm currently having a problem with rigid bodies and activation, more specifically they don't appear to deactivate when they come to rest. I am under the assumption that dynamic rigid bodies when they go below a threshold for linear and angular velocities they become inactive in respect to the simulation by default is this correct? If not could someone please enlighten me.

Any ways here how I currently setup the physics world.

Using Bullet 2.75
  • btDefaultCollisionConfiguration
  • btCollisionDispatcher constructed with the above configuration.
  • bytDbvtBroadphase
  • btSequentialImpulseConstraintsSolver for the solver
  • and they dynamics world is btDiscreteDynamicsWorld.
World units are unchanged.

I construct rigid bodies like so where shape is collision Object.

Code: Select all

	btVector3 localInertia(0.0f, 0.0f, 0.0f);
	if(mass > 0.0f)
	{
			shape->calculateLocalInertia(mass, localInertia);
	}
	//set the initial position of the body from the actor
	ActorMotionState* const myMotionState = FE_NEW ActorMotionState(actor->VGetMat());

	btRigidBody::btRigidBodyConstructionInfo rbInfo(mass, myMotionState, shape, localInertia);

	//setup material properties
	rbInfo.m_restitution = PhysicalProperties::GetMaterial(mat).m_restitution;
	rbInfo.m_friction = PhysicalProperties::GetMaterial(mat).m_friction;
	
	//create rigidbody and add it to the world.
	btRigidBody* const body = new btRigidBody(rbInfo); 
	m_dynamicsWorld->addRigidBody(body);

	body->setActivationState(ISLAND_SLEEPING);
Now I have checked the rigid body for linear and angular sleep thresholds are set (0.8 and 0.1) respectively I also drawn the debug mesh which depending on the colour represents the activation state. Green for island sleep and white if its active tag. The image attached shows the floor (which is a rigid body with 0 mass as green) but the all the other object remain white and no mater how still they are never sleep.

Am I missing something? Any help would be greatly appreciated.
You do not have the required permissions to view the files attached to this post.
fordprefect
Posts: 2
Joined: Thu Apr 15, 2010 5:53 pm

Re: rigidbodies activation state

Post by fordprefect »

Well it just goes to show that you can't protect yourself from yourself.

It works as intended, its just some fool passed DBG_NoDeactivation and then wondered why deactivation wasn't happening.