Type Function
Library physics.*
Return value none
Revision Release 2023.3686
Keywords MKS units, physics
See also physics.getMKS()


Sets the MKS (meters, kilograms, and seconds) value of the physics simulation for specific keys. This is strictly for advanced purposes — the average developer and project will not require this function.


physics.setMKS( key, value )
key (required)

String. The key to set MKS units for. Can be any one of the following values:

  • "velocityThreshold" — corresponds to b2_velocityThreshold.
  • "timeToSleep" — corresponds to b2_timeToSleep.
  • "linearSleepTolerance" — corresponds to b2_linearSleepTolerance.
  • "angularSleepTolerance" — corresponds to b2_angularSleepTolerance.
value (required)

Number. The value of for the chosen MKS key.


physics.setMKS( "timeToSleep", 10 )