Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults.
All properties have default values, and many are pre-calculated automatically based on other properties.
See the properties section below for detailed information on what you can pass via the options object.
body
Gets the current rotational velocity of the body.
angular velocity
Gets the current rotational velocity of the body.
angular velocity
Gets the current linear speed of the body. Equivalent to the magnitude of its velocity.
speed
Returns the next unique group index for which bodies will collide.
If isNonColliding is true, returns the next unique group index for which bodies will not collide.
See body.collisionFilter for more information.
OptionalisNonColliding: booleanUnique group index
Rotates a body by a given angle relative to its current angle, without imparting any angular velocity.
OptionalupdateVelocity: booleanGiven a property and a value (or map of), sets the property(s) on the body, using the appropriate setter functions if they exist. Prefer to use the actual setter functions in performance critical situations.
A property name (or map of properties and values) to set on the body.
Optionalvalue: anyThe value to set if settings is a single property name.
Sets the angle of the body instantly. Angular velocity, position, force etc. are unchanged.
OptionalupdateVelocity: booleanSets the angular velocity of the body instantly. Position, angle, force etc. are unchanged. See also Body.applyForce.
Sets the angular velocity of the body instantly. Position, angle, force etc. are unchanged. See also Body.applyForce.
Set the centre of mass of the body.
The centre is a vector in world-space unless relative is set, in which case it is a translation.
The centre of mass is the point the body rotates about and can be used to simulate non-uniform density.
This is equal to moving body.position but not the body.vertices.
Invalid if the centre falls outside the body's convex hull.
Sets the density of the body. Mass is automatically updated to reflect the change.
Sets the moment of inertia (i.e. second moment of area) of the body of the body. Inverse inertia is automatically updated to reflect the change. Mass is not changed.
Sets the mass of the body. Inverse mass and density are automatically updated to reflect the change.
Sets the parts of the body and updates mass, inertia and centroid.
Each part will have its parent set to body.
By default the convex hull will be automatically computed and set on body, unless autoHull is set to false.
Note that this method will ensure that the first part in body.parts will always be the body.
Sets the current linear speed of the body. Direction is maintained. Affects body velocity.
Sets the body as static, including isStatic flag and setting mass and inertia to Infinity.
Sets the body's vertices and updates body properties accordingly, including inertia, area and mass (with respect to body.density).
Vertices will be automatically transformed to be orientated around their centre of mass as the origin.
They are then automatically translated to world space based on body.position.
The vertices argument should be passed as an array of Matter.Vector points (or a Matter.Vertices array).
Vertices must form a convex hull, concave hulls are not supported.
Performs a simulation step for the given body, including updating position and angle using Verlet integration.
Updates properties body.velocity, body.speed, body.angularVelocity and body.angularSpeed which are normalised in relation to Body._baseDelta.
Applies a force to a body from a given world-space position, including resulting torque.