Scaling The World

From Physics Simulation Wiki

Jump to: navigation, search

By default, Bullet assumes units to be in meters and time in seconds. Moving objects are assumed to be in the range of 0.05 units, about the size of a pebble, to 10, the size of a truck. The simulation steps in fraction of seconds (1/60 sec or 60 hertz), and gravity in meters per square second (9.8 m/s^2).

If your objects are much bigger, and you use the default gravity, the simulation will appear in slow-motion. Try to scale down the objects to around 1 in meter units first.

Scaling the world is when you choose to use a different set of units. For example, using centimetres instead of metres. The effect is that Bullet deals with much larger (or possibly smaller) floating point values during its internal calculations.


Why Scale The World?

By scaling the world, you change dimensions and velocities appropriately so that they are back within the range that Bullet was designed for (0.05 to 10). Thus the simulation becomes more realistic.

Example Situations

Pool/Snooker Game
The balls are small, 4cm in diameter. In previous Bullet releases, many people have found Bullet to be insufficiently precise and have had success by scaling the world by a factor of 100, i.e. using centimetres instead of metres. Support for objects of this size has improved in Bullet 2.74.
Outer Space
If you make values too large, you may run into problems with the accuracy of the float itself, and also a SAP Broadphase may become prohibitively slow / large. Also, Bullet might not work properly if you use a triangle mesh with very large triangles. In this case you might consider using a unit like km, AU, light years, or whatever is appropriate to keep the numbers sensible.

How To Scale The World

Obviously any collision shapes must be scaled appropriately, but there are also some other things that need to be changed. In general, if you are scaling the world by a factor of X then you must do the following:

  • Scale collision shapes about origin by X
  • Scale all positions by X
  • Scale all linear (but not angular) velocities by X
  • Scale linear [Sleep Threshold] by X
  • Scale gravity by X
  • Scale all impulses you supply by X
  • Scale all torques by X^2
  • Scale all inertias by X if not computed by Bullet --> ?? should'nt this be X^2,unit of moment_of_inertia is kg*m^2

Damping is a ratio so this does not need to be changed.

Angular velocity should not need to be changed either.

If you find other things that need scaling, please add them here.

You should not have to change the mass unless you are dealing with massive spaceships or other situations where you start to stress the float representation. If you do scale it by a factor of Y then you must additionally: (untested)

  • Scale all impulses by Y
  • Scale all inertias by Y if not computed by Bullet
  • Scale all torques by Y

If you find other things that need scaling, please add them here.


Personal tools