WheelJoint2D
Optional feature
WheelJoint2D 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 { WheelJoint2DComponent } from "mmpx";
const wheelJoint2D = this.entity.TryGetComponent(WheelJoint2DComponent);Full API: WheelJoint2DComponent.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
Connected BodyconnectedBody | Rigidbody2D | — | The other Rigidbody2D — empty ties it to the world |
Enable CollisionenableCollision | boolean | false | Whether the two connected bodies still collide with each other |
Anchor XanchorX | number | 0 | |
Anchor YanchorY | number | 0 | |
Auto Connected AnchorautoConfigureConnectedAnchor | boolean | true | Puts the connected anchor where this anchor is when the joint is created |
Connected Anchor XconnectedAnchorX | number | 0 | |
Connected Anchor YconnectedAnchorY | number | 0 | |
Use MotoruseMotor | boolean | false |
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 |
Suspension
| Field | Type | Default | Description |
|---|---|---|---|
Angleangle | number (°) | 90° | Suspension direction in the connected body's frame (90° = up) |
Frequencyfrequency | number (0.01 … ∞) (Hz) | 4 | Suspension stiffness |
Damping RatiodampingRatio | number (0 … 1) | 0.7 |
Motor
| Field | Type | Default | Description |
|---|---|---|---|
SpeedmotorSpeed | number (°) | 0° | |
Max TorquemaxMotorTorque | number (0 … ∞) | 1000000 | kg·px²/s² |