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
StaticgetStaticgetStaticgetStaticnextStaticnextReturns 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
StaticrotateStaticscaleStaticsetGiven 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.
StaticsetStaticsetStaticsetStaticsetSet 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.
StaticsetStaticsetStaticsetStaticsetSets 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.
StaticsetStaticsetStaticsetStaticsetStaticsetSets 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.
StatictranslateStaticupdateStaticupdate
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.
Body