StaticapplyStaticcreateCreates 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
StaticgetGets the current rotational velocity of the body.
angular velocity
StaticgetGets the current rotational velocity of the body.
angular velocity
StaticgetGets the current linear speed of the body. Equivalent to the magnitude of its velocity.
speed
StaticnextStaticnextReturns 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
StaticrotateRotates a body by a given angle relative to its current angle, without imparting any angular velocity.
OptionalupdateVelocity: booleanStaticscaleStaticsetGiven 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.
StaticsetSets the angle of the body instantly. Angular velocity, position, force etc. are unchanged.
OptionalupdateVelocity: booleanStaticsetSets the angular velocity of the body instantly. Position, angle, force etc. are unchanged. See also Body.applyForce.
StaticsetSets the angular velocity of the body instantly. Position, angle, force etc. are unchanged. See also Body.applyForce.
StaticsetSet 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.
StaticsetSets the density of the body. Mass is automatically updated to reflect the change.
StaticsetSets 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.
StaticsetSets the mass of the body. Inverse mass and density are automatically updated to reflect the change.
StaticsetSets 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.
StaticsetStaticsetSets the current linear speed of the body. Direction is maintained. Affects body velocity.
StaticsetSets the body as static, including isStatic flag and setting mass and inertia to Infinity.
StaticsetStaticsetSets 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.
StatictranslateStaticupdatePerforms a simulation step for the given body, including updating position and angle using Verlet integration.
StaticupdateUpdates properties body.velocity, body.speed, body.angularVelocity and body.angularSpeed which are normalised in relation to Body._baseDelta.
The
Matter.Bodymodule contains methods for creating and manipulating body models. AMatter.Bodyis a rigid body that can be simulated by aMatter.Engine. Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the moduleMatter.Bodies.See the included usage examples.