Testing shape regions (a.k.a sensors and phantoms)

User avatar
glutinous
Posts: 3
Joined: Mon Sep 08, 2008 4:53 pm

Testing shape regions (a.k.a sensors and phantoms)

Post by glutinous »

There was talk of support for testing a shape region for collisions, without it actually interfering with other real bodies in the world. These are called phantoms in Havok.

http://www.bulletphysics.com/Bullet/php ... ntom#p6114

I was just wondering if this has been added now? As the message mentions 2.64 will have it. If not, any idea how it can be done with the latest release?

-Steven
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Testing shape regions (a.k.a sensors and phantoms)

Post by Erwin Coumans »

There are several ways to implement sensors/phantoms in Bullet.

In any case, the btCollisionObject should be excluded from normal collision response, using

Code: Select all

m_collisionObject->setCollisionFlags (btCollisionObject::CF_NO_CONTACT_RESPONSE);
Havok phantoms incrementally gather all objects that have AABB overlap with them, and perform exact overlap test on those. This is exactly what the CharacterDemo does: it registers a custom broadphase pair callback:

Code: Select all


	//some custom callback sample
	m_customPairCallback = new MyCustomOverlappingPairCallback(this,m_character->getCollisionObject());
	sweepBP->setOverlappingPairUserCallback(m_customPairCallback);
	m_character->registerPairCacheAndDispatcher (m_customPairCallback->getOverlappingPairCache(), m_dispatcher);

	///only collide with static for now (no interaction with dynamic objects)
	m_dynamicsWorld->addCollisionObject(m_character->getCollisionObject(),btBroadphaseProxy::DebrisFilter, btBroadphaseProxy::StaticFilter);
See the KinematicCharacterController in Bullet/Demos/CharacterDemo for more details.
Hope this helps,
Erwin
User avatar
glutinous
Posts: 3
Joined: Mon Sep 08, 2008 4:53 pm

Re: Testing shape regions (a.k.a sensors and phantoms)

Post by glutinous »

Excellent, thanks for pointers, Erwin!

-Steven