TargetJoint2D
Optional feature
TargetJoint2D is part of 2D Physics. A build includes it only when a scene, prefab or script uses it — see Feature cropping.
From a script
ts
import { TargetJoint2DComponent } from "mmpx";
const targetJoint2D = this.entity.TryGetComponent(TargetJoint2DComponent);Full API: TargetJoint2DComponent.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
Anchor XanchorX | number | 0 | |
Anchor YanchorY | number | 0 | |
Auto TargetautoConfigureTarget | boolean | true | Starts the target on the anchor (so nothing moves until the target does) |
Target XtargetX | number | 0 | World position |
Target YtargetY | number | 0 | |
Max ForcemaxForce | number (0 … ∞) | 100000 | kg·px/s² |
Frequencyfrequency | number (0.01 … ∞) (Hz) | 5 | How stiffly it follows |
Damping RatiodampingRatio | number (0 … 1) | 1 |
Breaking
| Field | Type | Default | Description |
|---|---|---|---|
Break ForcebreakForce | number (0 … ∞) | 0 | Breaks when pulled harder than this (kg·px/s²) — 0 = never |
Break TorquebreakTorque | number (0 … ∞) | 0 | Breaks when twisted harder than this (kg·px²/s²) — 0 = never |