Skip to content

Components

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

FieldScript nameKindDefaultWhat it does
Kindkindone of Pin, Groove, Spring, Distance, Slider, Fixed, TargetPinWhat it enforces.
TargettargettextemptyThe other node this is joined to.
Anchoranchortwo numbers (x, y)(0, 0)Where on this node the joint attaches, in local units.
Target Anchortarget_anchortwo numbers (x, y)(0, 0)Where on the other node it attaches, in local units.
Target Pointtarget_pointtwo numbers (x, y)(0, 0)Where a target joint pulls to, in world units.
Axisaxistwo numbers (x, y)(0, 1)Which way a groove or slider runs, in the target's space.
Lengthlengthnumber, at least 064How long the groove is, or how far apart a spring or a distance joint wants to be.
Weld Angleweld_anglenumber, step 10 °For a Fixed weld, the angle this node is held at, relative to its target, in degrees; a script sets it in radians.
Turns Bodyturns_bodycheckboxoffFor a Pin or Distance joint: this node turns as it swings, and its anchor turns with it.
Stiffnessstiffnessnumber, 0 to 1, step 0.010.5How hard a spring pulls back toward its rest length, from none to all at once.
Dampingdampingnumber, 0 to 1, step 0.010.1For 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.
EnabledenabledcheckboxonWhether it is enforced right now.
Limits
Use Limitsuse_limitscheckboxoffWhether the Min and Max range is enforced.
Minlimit_minnumber, step 10The near end of the allowed range for this joint. Shown when Use Limits is set
Maxlimit_maxnumber, step 164The far end of the allowed range for this joint. Shown when Use Limits is set
Motor
Use Motoruse_motorcheckboxoffWhether a Slider drives itself along its rail.
Speedmotor_speednumber, step 160 u/sHow fast the motor drives along the Axis direction, in units per second.
Max Stepmotor_max_stepnumber, at least 0, step 0.14 uThe most the motor can push in one update, in world units.
Breaking
Break Stretchbreak_stretchnumber, at least 00 uZero never breaks.
Break Twistbreak_twistnumber, at least 0, step 10 °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.