Static
Protected
_minStatic
Protected
_torqueStatic
Protected
_warmingStatic
createCreates a new constraint.
All properties have default values, and many are pre-calculated automatically based on other properties.
To simulate a revolute constraint (or pin joint) set length: 0
and a high stiffness
value (e.g. 0.7
or above).
If the constraint is unstable, try lowering the stiffness
value and / or increasing engine.constraintIterations
.
For compound bodies, constraints must be applied to the parent body (not one of its parts).
See the properties section below for detailed information on what you can pass via the options
object.
constraint
create
Static
currentReturns the current length of the constraint.
This is the distance between both of the constraint's end points.
See constraint.length
for the target rest length.
the current length
currentLength
Static
pointAWorldReturns the world-space position of constraint.pointA
, accounting for constraint.bodyA
.
the world-space position
pointAWorld
Static
pointBWorldReturns the world-space position of constraint.pointB
, accounting for constraint.bodyB
.
the world-space position
pointBWorld
Static
postPerforms body updates required after solving constraints.
postSolveAll
Static
prePrepares for solving by constraint warming.
preSolveAll
Static
solveSolves a distance constraint with Gauss-Siedel method.
solve
Static
solveSolves all constraints in a list of collisions.
solveAll
Generated using TypeDoc
The
Matter.Constraint
module contains methods for creating and manipulating constraints. Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position). The stiffness of constraints can be modified to create springs or elastic.See the included usage examples.