Physics Joints
Connect bodies with constraints
Joints create physical connections between nodes. Hinges, springs, ropes, welds — 6 joint types for building mechanisms, ragdolls, and interactive physics scenes.
Joint types
Revolute (hinge)
Two bodies share a pivot point. They rotate freely around it.
Use for: doors, wheels, pendulums, ragdoll limbs.
Node A ──●── Node B (pivot)
Optional: angle limits (min/max rotation), motor (target velocity or position with max force).
title: "Pendulum"
description: "A weight swinging from a fixed pivot point"
nodes:
- type: ELLIPSE, name: "Pivot", x: 200, y: 100, w: 16, h: 16, fill: "#2C3E50"
- type: RECT, name: "Arm", x: 200, y: 200, w: 10, h: 120, fill: "#7F8C8D"
- type: ELLIPSE, name: "Weight", x: 200, y: 280, w: 40, h: 40, fill: "#E74C3C"
modules:
- node: "Pivot", module: "physics", config: { bodyType: "static" }
- node: "Arm", module: "physics", config: { bodyType: "dynamic" }
- node: "Weight", module: "physics", config: { bodyType: "dynamic" }
joints:
- type: "revolute", bodyA: "Pivot", bodyB: "Arm", anchor: [200, 100]
- type: "revolute", bodyA: "Arm", bodyB: "Weight", anchor: [200, 260]
tools_visible: [select, play]
ui_visible: [properties, modules]Prismatic (slider)
Two bodies slide along an axis. No rotation at the joint.
Use for: pistons, sliding doors, elevators, rail-constrained objects.
Optional: position limits (min/max distance), motor.
Distance
Maintains a fixed distance between two anchor points. Bodies can rotate freely.
Use for: bridges (chain of distance joints), rigid connections, spacing constraints.
Optional: spring stiffness and damping for elastic distance constraints.
Weld
Locks two bodies together rigidly. No relative movement.
Use for: attaching decorations to physics bodies, creating compound shapes at runtime, breaking objects (remove the weld on impact).
Rope
Like distance but one-way — maximum length only, no minimum. Bodies can be closer but not farther than the rope length.
Use for: actual ropes, chains, tethered objects, grappling hooks.
Spring
Two anchor points connected by a spring with configurable rest length, stiffness, and damping.
Use for: soft connections, suspension, wobbly platforms, bouncy bridges.
Parameters: restLength: 100 ← natural length stiffness: 50 ← spring constant (higher = stiffer) damping: 5 ← energy loss (higher = less oscillation)
Joint properties
| Property | Type | Description |
|---|---|---|
type | enum | revolute, prismatic, distance, weld, rope, spring |
bodyA | node | First connected node |
bodyB | node | Second connected node |
anchor | point | World-space pivot point (revolute, weld) |
anchorA | point | Anchor on body A (distance, rope, spring) |
anchorB | point | Anchor on body B (distance, rope, spring) |
axis | vector | Slide direction (prismatic only) |
limits | [min, max] | Angle or position limits |
motor | object | Target velocity/position + max force |
stiffness | number | Spring constant (spring, distance) |
damping | number | Energy dissipation (spring, distance) |
length | number | Fixed/max distance (distance, rope) |
restLength | number | Natural length (spring) |
Motors
Revolute and prismatic joints support motors — active forces that drive the joint toward a target.
Velocity motor — spin at a target speed:
Motor: targetVelocity = 3.14, maxForce = 100
Use for: wheels, conveyor belts, rotating platforms.
Position motor — hold a target angle/position:
Motor: targetPosition = 0, maxForce = 200
Use for: servo arms, auto-closing doors, self-righting objects.
Formula integration
Joint properties are accessible in formulas:
// Motorized wheel controlled by keyboardwheel_joint.motorSpeed = keys.ArrowRight ? 5 : (keys.ArrowLeft ? -5 : 0)
``// Spring stiffness based on sliderbridge_spring.stiffness = Slider.value * 100
Creating joints
- Select two physics nodes
- Click "Add Joint" in the physics panel
- Choose joint type
- Set anchor points by clicking on the canvas
- Configure properties in the panel
Joints are visible as dotted lines between connected nodes in the editor overlay.
→ Back to physics → Bodies → Colliders