verlet-constraint1.1.0 • Public • Published
Creates a single 2D/3D constraint, useful in a verlet physics system.
var Constraint =var Point =var points = Point Pointvar c =//this pulls/pushes the two pointsc
The points can be bare objects with
position and optional
mass. Mass defaults to 1.0.
var c =c
By default, assumes 2D and points with
[x, y]. You can require an explicit dimension like so:
var Constraint2D = //points [x, y]var Constraint3D = //points [x, y, z]
c = Constraint(points[, opt])
Creates a new constraint that operates on the two point objects given in the
points array. Options:
restingDistancethe desired resting distance between the two points, defaults to using the distance between the two points during construction
stiffnessthe stiffness of the constraint, defaults to 1.0
Solves this constraint by pushing/pulling each point. If one of the points has a mass of zero, that body will be considered "unmovable".
An array of the point objects that were specified to this constraint.
The desired distance
The desired stiffness
MIT, see LICENSE.md for details.