Skip to main content

Class: DistanceConstraint

Defined in: src/mobjects/physics/constraints.ts:76

A rigid distance constraint. It keeps endpoint a and endpoint b a fixed length apart by correcting positions after integration. The correction splits between the endpoints by inverse mass, so a body pinned to a fixed point moves alone.

Implements​

Constructors​

Constructor​

new DistanceConstraint(a, b, length, options): DistanceConstraint

Defined in: src/mobjects/physics/constraints.ts:82

Parameters​

a​

Anchor

b​

Anchor

length​

number

options​

DistanceConstraintOptions = {}

Returns​

DistanceConstraint

Accessors​

length​

Get Signature​

get length(): number

Defined in: src/mobjects/physics/constraints.ts:90

The target distance between the endpoints.

Returns​

number

Methods​

clone()​

clone(map): DistanceConstraint

Defined in: src/mobjects/physics/constraints.ts:123

Return a copy of this constraint with bodies remapped through map.

Parameters​

map​

Map<Body, Body>

Returns​

DistanceConstraint

Implementation of​

Constraint.clone


solvePositions()​

solvePositions(): void

Defined in: src/mobjects/physics/constraints.ts:94

Correct the linked body positions after integration. Optional.

Returns​

void

Implementation of​

Constraint.solvePositions