API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
interfaceDistanceJointOptions
@codexo/exojs-physics / physics / stable
Construction options for a DistanceJoint.
10
props
0
methods
0
events
Import
import { DistanceJointOptions } from '@codexo/exojs-physics'Construction options for a DistanceJoint.
Properties10
anchorA?: Readonly<PointLikeStructural type for any object with a 2D `x`/`y` position.>World-space anchor on body A at creation. Default: body A's position.
anchorB?: Readonly<PointLikeStructural type for any object with a 2D `x`/`y` position.>World-space anchor on body B at creation. Default: body B's position.
First body (often a static anchor).
Second body.
collideConnected?: booleanWhether the two bodies this joint connects also collide with each other. Default true. false is what a chain, a ragdoll, a pendulum or a vehicle assembly usually wants, and what Box2D defaults to: a joint already decides how its two bodies may move relative to one another, so letting their touching colliders push each other apart at the same time gives the pair two constraint systems with different opinions, plus a contact per link that nothing needs. The default is nevertheless true, which is the behaviour every joint has had so far: an existing scene built against it would change shape under an update that flipped it. Nothing else argues for true any more - a chain of seven links and up used to gain energy without these contacts, and that defect is fixed in the joint solver rather than damped by them - so the default is a compatibility choice and is free to be revisited. Nothing about a contact is weakened under true: the narrow phase produces it, the contact graph holds it, collision events fire, a ContactModifier sees it and the solver resolves it, exactly as for any unjointed pair. It is fixed at construction, and it follows the joint's presence in the world rather than Joint.enabled: disabling a joint suspends its constraint, and a ragdoll whose joints are momentarily disabled must not start pushing its own limbs apart. Removing the joint from the world does let the pair collide again, and both bodies are woken so they respond to it.
dampingRatio?: numberSoft-spring damping ratio (used when hertz > 0). Default 1.
hertz?: numberSoft-spring frequency in Hz; 0 (default) makes it a rigid constraint.
length?: numberTarget distance between the anchors. Default: their initial distance.
maxLength?: numberMaximum allowed distance (the rope length). See minLength. Defaults to Infinity in limit mode.
minLength?: numberMinimum allowed distance. Specifying minLength and/or maxLength turns the joint into a **rope/limit** (distance kept within [minLength, maxLength], slack between, rigid limits). Otherwise the joint is a rigid/soft **equality** at length. Defaults to 0 in limit mode.
Source