Collision detection frame coherence at the midphase

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
sphet
Posts: 38
Joined: Mon May 06, 2013 6:14 pm

Collision detection frame coherence at the midphase

Post by sphet »

Hello,

I wonder if anyone has experience with frame coherence within the midphase of the collision detection. We exploit ghost/phantom style queries to help accelerate our triangle queries for a couple of decals that are generated per frame. While the ghost gives us a subset of the broadphase agents, one of the shapes returned is the triangle mesh. This mesh is giant, and spans the scene. We have an acceleration structure (octree or kd-tree) to help partition the space but we still have to do that midphase lookup every frame, even if the overlapping pairs have not changed.

My question is if anyone has experimented with some kind of frame-to-frame caching within midphases, and if so do they have a generalized approach that works well?

S
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Collision detection frame coherence at the midphase

Post by Dirk Gregorius »

Take the current ghost/phantom AABB if you hit the mesh and inflate it (e.g. either statically or dynamically anticipating the current movement). Use this AABB to query your triangles and cache the indices. In the next frame you first check if your current AABB is inside the inflated AABB you used the frame before. If yes, you hit the cache and you can reuse the triangle indices. Otherwise re-query. How much you need to inflate or if you need to anticipate the movement depends on your use case, but this should be easy to tweak.
sphet
Posts: 38
Joined: Mon May 06, 2013 6:14 pm

Re: Collision detection frame coherence at the midphase

Post by sphet »

Dirk,

Thanks for taking the time to reply. I'll give that a try and see if I can somehow formalize it into a generalization for different agents.

Best,

S
Post Reply