The jit.phys.world object encapsulates a physics simulation context to perform collision detection and rigid body dynamics on its child objects. Other physics objects in the same patch as a jit.phys.world object are automatically added to the world. Multiple contexts can be managed by explicitly setting the name attribute of the jit.phys.world object and the worldname attribute of the child physics objects. Dynamics can be disabled, allowing the world to be used solely for collision detections. A 2D simulation is achieved with the remove_plane attribute.
The physics engine maintains an internal timer for simulation steps that decouples the physics step frequency from the rendering frame rate. The fixedtimestep attribute controls the physics engine frequency, and the maxsubsteps attribute clamps the number of steps allowed between updates. The default frequency of 60 and maxsubsteps of 1 requires a FPS of 60. If the FPS is 30, maxsubsteps should be increased (allowing for more than 1 simulation step each update). If the simulation is behaving incorrectly (rigid body penetration, erratic movement, etc), try increasing the simulation frequency and sub-steps.
Enables and disables automatic mode where update messages are received from that target jit.gl.render object (default = 1).
Specifies the format of the collisions dictionary (default = simple)
'simple' ( Report contact point positions and normals average )
'complete' ( All contact point position and normals reported )
Enables and disables collision reporting out the second (dumpout) outlet.
Assign to the named drawing context, allowing for updates to be received automatically.
Enables and disables rigid-body dynamics.
Enable the physics simulation for all objects in this physics context (default = 1).
Fixed time step value (Hz) of physics simulation (default = 60). Increasing this value increases the resolution of the simulation.
gravity [3 floats]
A 3D vector describes the force of gravity applied to all objects in the world (default = 0, -9.8, 0).
Maximum number of internal simulation steps between updates (default = 1). Increase this number if FPS is low in order to prevent the simulation from losing time.
Specifies the name of the instance (default = UID).
Specifies the number of collision points in the world.
Sets the number of collison dispatcher threads (default = 1). Increasing the number of threads may improve performance, especially for physics scenes with distinct and separate groups of colliding objects.
Specifies how raytest messages return object hits for the
'closest' ( Return only the object closest to the camera )
'all' ( Return all intersecting objects )
Remove plane to enable 2D simulation (default = none).
0 = 'none'
1 = 'x' ( Constrain simulation to Y and Z planes )
2 = 'y' ( Constrain simulation to X and Z planes )
3 = 'z' ( Constrain simulation to X and Y planes )
Enables and disables split impulse dynamics (default = 1). When enabled, split impulse will allow the dynamics solver to apply positional corrections when deep collision penetrations occur.
Specifies the name of a jit.gl.render object to receive update messages from.
Enables and disables the world bounds. (default = 1)
worldbox_scale [3 floats]
Changes the size and shape of the world bounds (default = 5, 5, 5).
Common Box Attributes