Page 1 of 1

compound shape / dynamic AABB tree question

Posted: Wed Jan 04, 2023 12:51 pm
by gjaegy
Hi,

This might sound like a terrible question, but I'm not fully sure of the answer.

The compound shape constructor has a "enableDynamicAabbTree" parameter. That tree is used to accelerate early rejection.

In the case all shapes added to a compound shape are static (i.e. not moving), does that AABB tree still help with performance ? I guess it does, I assume "dynamic" means the bounding volume hierarchy is based on a dynamic space partition (vs. its purpose being dynamic children handling), but could anyone confirm this ?

Thanks,
Greg

Re: compound shape / dynamic AABB tree question

Posted: Fri Jan 06, 2023 4:21 pm
by drleviathan
Yes, the dynamic AABB tree helps, even for static compound shapes, especially for compound shapes with many child shapes. It is used in the narrowphase collision calculation to cull the number of contact point candidates.

The only reason to NOT enable the dynamic AABB tree would be for a compound shape has only a few child shapes, when the unrolled "check every child shape" algorithm is faster than the overhead of storing the tree structure and performing queries against it. However I don't know where the transition would happen: 4, 8, 16,... children? You would have to run benchmarks to figure it out.