You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to start a discussion about MOAI conversion between units and box2d meters. Since I'm writing liquidfun bindings at the moment, some of MOAI's unit scaling require rethink.
It is currently applied to all values:
Position and shape dimensions
Velocity, gravity, forces and impulses
Density
I'm perfectly fine about 1) - it is very convenient and keeps me from manually multiplying values in lua.
2) is a kind of personal taste. I just more used to meters, but I can use units perfectly without converting them in lua.
The actual problem is with number 3). Density is specified in units too, and it's massively counterintuitive. Example:
world:setUnitsToMeters ( 0.05 )
-- now to use the default box2d density of 1 kg/m^2-- we must do this:fixture:setDensity ( 1*0.05*0.05 )
Working with densities in range from 0.00025 to 0.025 isn't easy or intuitive. But this is the values box2d expect - from 0.1 to 10 kg / m^2
Proper unit scale is crucial for box2d. It is tuned to work with sizes from 0.1 to 10 m and densities in the same range. Rigidbody physics is stable enough, so probably you haven't seen issues using wrong scale. But liquid is another beast - there are tons of constants and scaling 10x will blow up simulation.
TL;DR: Let us change density to not use UnitsToMeters and be always in kg / m^2. Also we may consider changing default UnitsToMeters from 1 to 0.05 or so.
The text was updated successfully, but these errors were encountered:
I want to start a discussion about MOAI conversion between units and box2d meters. Since I'm writing liquidfun bindings at the moment, some of MOAI's unit scaling require rethink.
It is currently applied to all values:
I'm perfectly fine about 1) - it is very convenient and keeps me from manually multiplying values in lua.
2) is a kind of personal taste. I just more used to meters, but I can use units perfectly without converting them in lua.
The actual problem is with number 3). Density is specified in units too, and it's massively counterintuitive. Example:
Working with densities in range from 0.00025 to 0.025 isn't easy or intuitive. But this is the values box2d expect - from 0.1 to 10 kg / m^2
Proper unit scale is crucial for box2d. It is tuned to work with sizes from 0.1 to 10 m and densities in the same range. Rigidbody physics is stable enough, so probably you haven't seen issues using wrong scale. But liquid is another beast - there are tons of constants and scaling 10x will blow up simulation.
TL;DR: Let us change density to not use UnitsToMeters and be always in kg / m^2. Also we may consider changing default UnitsToMeters from 1 to 0.05 or so.
The text was updated successfully, but these errors were encountered: