ForcePivotConstraint

ForcePivotConstraint is a Constraint that limits the motion of a particle to a certain length away from a point in space. The implementation of this constraint is force-based like that of ForceDistanceConstraint.

Constructor

new ForcePivotConstraint(pos, c1, len, stiffness, breakForce, dampening)

Instantiates new ForcePivotConstraint

Parameters:
NameTypeDefaultDescription
posVector2D

position of pivot

c1Particle

constrained particle

lenNumber

constrained length

stiffnessNumber

the "spring constant", higher values are more stiff

breakForceNumber

force at which the constraint breaks

dampeningNumber0

damping force on constraint, must be greater than 0

Extends

Methods

applyCorrection(timeStep)

Applies positional correction on particle.

Parameters:
NameTypeDescription
timeStepNumber

particles() → {Array.<Particle>}

Calculates the list of particles that is involved with the constraint

Returns:
Type: 
Array.<Particle>

update(timeStep)

Updates the constraint.

Parameters:
NameTypeDescription
timeStepNumber

vertices() → {Array.<Vector2D>}

Calculates the list of vertices that will be used in the rendering process

Returns:
Type: 
Array.<Vector2D>