Joint
Pins, welds, springs or slides this node against another, or against a fixed point. A hanging chain, a swinging sign, a piston, a lift, or a grapple line.
On this page
Add it
+ Add node → Joint creates a node with it already on. Already have a node for it? Add component → JointComponent.
From a script
A script on the same node writes these fields by name. JointComponent is the name to pass.
rgs
set_text("JointComponent", "target", "");
set_point("JointComponent", "anchor", vec2(0.0, 0.0));
set_point("JointComponent", "target_anchor", vec2(0.0, 0.0));
set_point("JointComponent", "target_point", vec2(0.0, 0.0));
set_point("JointComponent", "axis", vec2(0.0, 1.0));
set_number("JointComponent", "length", 64.0);
set_number("JointComponent", "weld_angle", 0.0);
set_flag("JointComponent", "turns_body", false);
set_number("JointComponent", "stiffness", 0.5);
set_number("JointComponent", "damping", 0.1);
set_flag("JointComponent", "enabled", true);
set_flag("JointComponent", "use_limits", false);
set_number("JointComponent", "limit_min", 0.0);
set_number("JointComponent", "limit_max", 64.0);
set_flag("JointComponent", "use_motor", false);
set_number("JointComponent", "motor_speed", 60.0);
set_number("JointComponent", "motor_max_step", 4.0);
set_number("JointComponent", "break_stretch", 0.0);
set_number("JointComponent", "break_twist", 0.0); Fields
| Field | Script name | Kind | Default | What it does |
|---|---|---|---|---|
| Kind | kind | one of Pin, Groove, Spring, Distance, Slider, Fixed, Target | Pin | What it enforces. |
| Target | target | text | empty | The other node this is joined to. |
| Anchor | anchor | two numbers (x, y) | (0, 0) | Where on this node the joint attaches, in local units. |
| Target Anchor | target_anchor | two numbers (x, y) | (0, 0) | Where on the other node it attaches, in local units. |
| Target Point | target_point | two numbers (x, y) | (0, 0) | Where a target joint pulls to, in world units. |
| Axis | axis | two numbers (x, y) | (0, 1) | Which way a groove or slider runs, in the target's space. |
| Length | length | number, at least 0 | 64 | How long the groove is, or how far apart a spring or a distance joint wants to be. |
| Weld Angle | weld_angle | number, step 1 | 0 ° | For a Fixed weld, the angle this node is held at, relative to its target, in degrees; a script sets it in radians. |
| Turns Body | turns_body | checkbox | off | For a Pin or Distance joint: this node turns as it swings, and its anchor turns with it. |
| Stiffness | stiffness | number, 0 to 1, step 0.01 | 0.5 | How hard a spring pulls back toward its rest length, from none to all at once. |
| Damping | damping | number, 0 to 1, step 0.01 | 0.1 | For a Spring or Target: the share of the moving end's speed taken off on every pass of every step (four a step), so 0.1 leaves about two-thirds of it each step. A Target with Use Limits on is a rope: it does not damp while slack, nor a body it alone swings. |
| Enabled | enabled | checkbox | on | Whether it is enforced right now. |
| Limits | ||||
| Use Limits | use_limits | checkbox | off | Whether the Min and Max range is enforced. |
| Min | limit_min | number, step 1 | 0 | The near end of the allowed range for this joint. Shown when Use Limits is set |
| Max | limit_max | number, step 1 | 64 | The far end of the allowed range for this joint. Shown when Use Limits is set |
| Motor | ||||
| Use Motor | use_motor | checkbox | off | Whether a Slider drives itself along its rail. |
| Speed | motor_speed | number, step 1 | 60 u/s | How fast the motor drives along the Axis direction, in units per second. |
| Max Step | motor_max_step | number, at least 0, step 0.1 | 4 u | The most the motor can push in one update, in world units. |
| Breaking | ||||
| Break Stretch | break_stretch | number, at least 0 | 0 u | Zero never breaks. |
| Break Twist | break_twist | number, at least 0, step 1 | 0 ° | How far a Fixed weld may be twisted off its angle before it breaks, in degrees; a script sets it in radians. Zero never breaks. |