Physics · interface
JointDesc
Explained in Your first game, Rigid bodies.
interface JointDescimport type { JointDesc } from '@driftengine/physics';Properties
| Name | Type | Description |
|---|---|---|
typereadonly | JointType | |
bodyAreadonly | number | |
bodyBreadonly | number | |
anchorAXreadonlyoptional | number | Anchor in each body's local frame. |
anchorAYreadonlyoptional | number | |
anchorAZreadonlyoptional | number | |
anchorBXreadonlyoptional | number | |
anchorBYreadonlyoptional | number | |
anchorBZreadonlyoptional | number | |
axisXreadonlyoptional | number | The free axis, in A's local frame: a hinge turns about it, a slider travels along it. |
axisYreadonlyoptional | number | |
axisZreadonlyoptional | number | |
lengthreadonlyoptional | number | Distance joints: the length held. Others: unused. |
lowerreadonlyoptional | number | Limits, as a cosine for a cone and as metres or a sine of a half-angle otherwise. |
upperreadonlyoptional | number | |
swingCosreadonlyoptional | number | A cone half-angle's cosine, and a twist half-angle's sine. Cone-twist only. |
twistSinreadonlyoptional | number | |
motorSpeedreadonlyoptional | number | |
motorMaxForcereadonlyoptional | number | |
breakImpulsereadonlyoptional | number | Accumulated impulse above which the joint gives way. Infinity never breaks. |
dofreadonlyoptional | readonly DofMode[] | Six-DOF only: what each degree of freedom does.MoreThe order is linear x, y, z then angular x, y, z, all in body A's local frame — not in a frame of the joint's own. Cost: a caller wanting axes that are not A's own has to orient A, or place the anchors so that A's frame is the one it means. What would reverse it: a consumer whose parent body cannot be oriented, and the answer then is four more floats per joint holding a frame quaternion. Shorter than six, or absent, and the rest are locked. |
dofLowerreadonlyoptional | readonly number[] | Lower bounds, one per degree, read only where the mode is DOF_LIMITED.MoreLinear bounds are metres of offset from the anchor; angular bounds are sines of half
angles. The second is this package's own convention rather than a shortcut — a swing limit
compares a dot product against a stored cosine and a twist limit a quaternion component against
a half-angle's sine, because |
dofUpperreadonlyoptional | readonly number[] | Upper bounds, in the same units and the same order. |