Inconsistent/inaccurate AABB calculation for small shapes

Post Reply
Aster
Posts: 4
Joined: Sat Sep 26, 2015 11:51 am

Inconsistent/inaccurate AABB calculation for small shapes

Post by Aster »

Hi,

Yesterday I posted about scaling my simulation down to allow for larger masses ( http://www.bulletphysics.org/Bullet/php ... =9&t=10836 ).

I noticed that as the scale factor went down, the simulation behaved differently, which is to be expected. However, if the scale factor is 1e-3 or lower, then one of my objects (let's call it the ship) hits an invisible wall, which I presume is an inaccurate placement of another object's mesh (let's call it the planet).
Indeed, once I enabled debug drawing, I noticed that this "wall" was very close to the border of the planet's AABB, which was far from being a "decent" AABB for the planet's mesh, since it was much larger than the mesh. The ship's AABB was nowhere to be seen.

I made the scale factor 1 again and saw that everything was back to normal, and as I turned it back down (by negative powers of 10), it seemed that the "inaccuracy" of the AABBs was climbing as the scale factor was dropping.
This is especially interesting considering that the wireframe drawn by my Bullet debug drawer was exactly how it should be.

I also get the "Overflow in AABB, object removed from simulation" error once in a while, seemingly randomly, but I'm not sure if that's related.

Here is a video of the ship getting stuck on the AABB wall with a scale factor of 1e-3: http://f.cxx.ninja/Videos/space_201509271805.webm
Here is what it should look like, with a scale factor of 1e-2: http://f.cxx.ninja/Videos/space_201509271809.webm
Here is a labelled photo album of the different AABBs at different scale factors: http://imgur.com/a/Dx0ZT

Scaling is done by multiplying the vertex data (and mass etc) by the scale factor.

Is there a way to fix this? Is this expected behavior?

Any help is greatly appreciated,
Cheers

EDIT: This still happens with a double-precision build of Bullet.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Inconsistent/inaccurate AABB calculation for small shape

Post by drleviathan »

I wonder if you're actually seeing the "collision margin" of the shapes. For more information about the margin I suggest you watch this youtube video.
Aster
Posts: 4
Joined: Sat Sep 26, 2015 11:51 am

Re: Inconsistent/inaccurate AABB calculation for small shape

Post by Aster »

drleviathan wrote:I wonder if you're actually seeing the "collision margin" of the shapes. For more information about the margin I suggest you watch this youtube video.
In that code, I set the margin of every shape to 0.0.
I tried setting the margin of the planet to 0.04 * simulation_scale, which didn't work either (because the margin becomes tiny in Bullet's eyes at a scale of 1e-3). Setting the scale of the rocket doesn't work either because its individual parts then have gaps between them when attached.

Someone brought up that this might be related to Bullet's use of a relatively high epsilon, which is 1e-6 for single-precision, and close to 1e-24 for double-precision.
Post Reply