Hide body

sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Hide body

Post by sara »

Hi,

I'm trying to hide and stop simulating a RigidBody at a certain point. I tried doing:

body->setFlags(btRigidBody::CF_STATIC_OBJECT|btRigidBody::CF_DISABLE_VISUALIZE_OBJECT);

but I can still see the body.
Is there any way to do this without deleting or removing the object?

Thanks!!
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Hide body

Post by sara »

Anybody?
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Hide body

Post by Flix »

Code: Select all

enum btCollisionObject::CollisionFlags	//object->getCollisionFlags()
	{
		CF_STATIC_OBJECT= 1,
		CF_KINEMATIC_OBJECT= 2,
		CF_NO_CONTACT_RESPONSE = 4,			//object->hasContactResponse()
		CF_CUSTOM_MATERIAL_CALLBACK = 8,//this allows per-triangle material (friction/restitution)
		CF_CHARACTER_OBJECT = 16,
		CF_DISABLE_VISUALIZE_OBJECT = 32, //disable debug drawing
		CF_DISABLE_SPU_COLLISION_PROCESSING = 64//disable parallel/SPU processing
	};
// So:
myCollisionObject->setCollisionFlags(myCollisionObject->getCollisionFlags()|CF_DISABLE_VISUALIZE_OBJECT);	
// Just disables debug drawing for this object
I don't think you can "hide" the object inside libBulletOpenGL, although you can probably change "the collision filter group" to some "invisible group", such as sensor trigger, (by removing/readding the object from/to the world) and in your CUSTOM implementation of libBulletOpenGL (or just overriding some rendering methods using the default implementation maybe...) not display objects belonging to that group.

To disable an object from being simulated inside Bullet without taking it off from the world, you must use:

Code: Select all

myCollisionObject->forceActivationState(DISABLE_SIMULATION);
,but I don't think that this disables the "rendering code" in libBulletOpenGL.
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Hide body

Post by sara »

Thank you very much for your answer!! I'll try it out.