[Solved] Working with maximum mass

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

[Solved] Working with maximum mass

Post by Aster »

Hi,

I'm currently trying to write an n-body simulation using Bullet for physics, and it seems rigid bodies with a mass of 1e15 or higher break with a single precision build:

Code: Select all

Overflow in AABB, object removed from simulation
If you can reproduce this, please email bugs@continuousphysics.com

Please include above information, your Platform, version of OS.

Thanks.
Other than scaling everything down, are there any solutions to this? What's the best way to work with bodies with wide ranges of masses? (Anywhere from 1e-3 to 1e35, although a higher range is always better. I'm using SI derived units).

Any help would be greatly appreciated.
Thanks
Last edited by Aster on Sat Sep 26, 2015 4:40 pm, edited 1 time in total.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Working with maximum mass

Post by Basroil »

Simple answer, you can use double precision or use a smaller range of masses, if you use ridiculously large numbers you will hit floating point limits on single precision fairly quickly.

If you're up for a challenge though, you can pull a havok and deal with high mass ratios separately (usually clamping the ratio since anything above a certain threshold will likely act like a collision against a static object)
Aster
Posts: 4
Joined: Sat Sep 26, 2015 11:51 am

Re: Working with maximum mass

Post by Aster »

Basroil wrote:Simple answer, you can use double precision or use a smaller range of masses, if you use ridiculously large numbers you will hit floating point limits on single precision fairly quickly.
I ended up just scaling the whole simulation by 1e-6, and everything seems to be stableish so far. I don't really like the solution as it's quite error prone, but it's by far the simplest.
If I run into any precision issues, I'll switch to double precision.

Thanks for your answer!
Post Reply