bug in body.mass

I just played around with body.mass to Get my crane simulation working ( @Simeon the one with tha chain, i tried to reduce the Maß so ist works…), and found two bugs:

  • if the body.mass is bigger than 1, codea crashes.
  • if body.mass is too small, the behavior while dragging it aruond is very very strange

thats actually it… but One question: which number am i supposed to give as Body.mass? Any suggestions?


Can you show me the code where you are setting the mass?

I’ve just run a test with the Physics Lab example and setting a dynamic object’s mass to 10 doesn’t cause any issues. Setting it to 0.001 does cause instability. You should probably keep the mass of objects around the 0.1 → 10 range to keep things relatively stable. When objects collide with a greater than 1/10 ratio between masses you are likely to see some problems, this is just how the physics engine works (Box2D) because it uses an iterative solver.

An alternative to setting mass directly is setting density, which will set the mass based on its volume.

I posted the Code before, its here: http://twolivesleft.com/Codea/Talk/discussion/719/how-can-i-force-the-joints-to-be-stricter-s#Item_6

The Last function in the main is createWorld(), there just Set the Mass of the crane (actually its nothing, it will be a crane) to 2 or higher, or to 1 lower than 1. Am i doing anything wrong?