Hello,
I'm using btPairCachingGhostObject to create triggers.
I'd like to know when a body is Entering, Staying, and Leaving the trigger.
Is there a way to retrieve this kind of information from bullet or do I have to maintain my own list and do the checks myself ?
Thanks
Ghost and overlap history
-
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: Ghost and overlap history
Not possible, but some time ago I posted some code to enable onStartCollision, onCollisionContinue, onCollisionStop events for rigid bodies (but not ghost objects). You may check my code from this post:noon wrote:Is there a way to retrieve this kind of information from bullet or do I have to maintain my own list and do the checks myself ?
http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=1691
The drawback is that it slows down the simulation a bit; thus you can try and see if it's useful for you...
P.S. Plain rigid bodies can be assigned a "NO_CONTACT_RESPONSE" flag, so that they can behave a bit like ghost objects...
-
- Posts: 237
- Joined: Tue Jun 29, 2010 10:27 pm
Re: Ghost and overlap history
For enter-leave triggers, you can implement your own subclass of btCollisionDispatcher, overriding the methods getNewManifold and releaseManifold, which are called once when two objects come into contact or move apart, respectively. This is fast - it just uses existing methods to which you can add your own code. I'm not sure if this detects broadphase or narrowphase("actual") contacts, but it worked well for something I was doing in my simulation. As for which objects are "staying" in the ghost, you can just query the ghost's pair cache at any time to see what's currently in contact with it.