A box is defined by its dimensions along the corresponding axes. To create a 1x1 box, call this:
box { x = 1, y = 1, z = 1 } dataA plane with the normal that points in the direction of the z axis.
A plane is collidable in the direction of the normal.
A sphere is defined by its radius.
Set the body mass. Bodies with zero mass don’t move!
Set the absolute position of the body in the world.
Get the position and the orientation of the body in a single matrix.
Elements are given by their row and column indices, starting at 1,
so m23 means the element in the second row, third column.
To use this with WebGL, pass the result to Math.Matrix4.fromRecord.
Set the material to controll friction and bounciness.
Move the body by a vector offset from the current position.
Rotate the body by a specific angle around the axis from the current orientation. Angle must be specified in radians.
Set the body orientation to a unit quaternion.
Get orientation as a unit quaternion.
Set user-defined data.
Get user-defined data.
Make a compound body from a list of shapes.
For example, the sphere from above can be defined like this:
sphere radius data =
compound [ Shape.sphere radius ] dataWe only support rigid bodies.
Represents a physical body containing user defined data, like a WebGL mesh.
By default a body is positioned in the center of the world and has zero mass. To change this, use setPosition or setMass. Bodies with zero mass don’t move!
The supported bodies are:
For complex bodies check compound.