Joint
Connects two bodies: hinge (revolute), distance, slider (prismatic), weld, wheel or motor; motors, springs and limits. Pick Body A (default: parent) and Body B.
Type: JointNode · Category: Physics & Collision · Also found as: joint, physicsjoint
Properties
Section titled “Properties”| Property | Type | Default | Description |
|---|---|---|---|
joint.type |
enum: Distance, Filter, Motor, Mouse, Prismatic, Revolute, Weld, Wheel |
Revolute |
Kind of joint; only that kind’s settings are shown. |
joint.distance.localAnchorA |
vec2 | (0, 0) |
Anchor on body A, relative to its origin (px). Range -500 to 500. |
joint.distance.localAnchorB |
vec2 | (0, 0) |
Anchor on body B, relative to its origin (px). Range -500 to 500. |
joint.distance.length |
number | 100 |
Rest distance between the anchors (px). Range 1 to 1000. |
joint.distance.enableSpring |
boolean | false |
Make the joint springy instead of rigid. |
joint.distance.hertz |
number | 4 |
Spring stiffness as an oscillation frequency (Hz); 0 = no spring. Range 0 to 60. |
joint.distance.dampingRatio |
number | 0.5 |
Spring damping: 0 bounces forever, 1 settles without overshoot. Range 0 to 10. |
joint.distance.enableLimit |
boolean | false |
Clamp the joint’s travel to the lower / upper limits. |
joint.distance.minLength |
number | 20 |
Shortest the joint may get (px; with the limit on). Range 0 to 1000. |
joint.distance.maxLength |
number | 200 |
Longest the joint may get (px; with the limit on). Range 1 to 1000. |
joint.distance.enableMotor |
boolean | false |
Drive the joint at Motor Speed, up to the maximum force / torque. |
joint.distance.maxMotorForce |
number | 100000 |
Strongest push the motor applies (pixel-scale bodies are heavy: mass ~ area in px²). Range 0 to 1e+08. |
joint.distance.motorSpeed |
number | 0 |
Speed the motor lengthens (+) or shortens (-) the joint (px/s). Range -500 to 500. |
joint.distance.collideConnected |
boolean | false |
Let the two connected bodies collide with each other. |
joint.motor.linearOffset |
vec2 | (0, 0) |
Where body B is driven to, relative to body A (px). Range -500 to 500. |
joint.motor.angularOffset |
number | 0 |
Angle body B is driven to, relative to body A (degrees). Range 0 to 360. |
joint.motor.maxForce |
number | 100000 |
Strongest pull towards the offset (pixel-scale bodies are heavy). Range 0 to 1e+08. |
joint.motor.maxTorque |
number | 5000000 |
Strongest twist towards the angle (pixel-scale bodies are heavy). Range 0 to 1e+08. |
joint.motor.correctionFactor |
number | 0.3 |
How quickly position errors are corrected (0-1). Range 0 to 1. |
joint.motor.collideConnected |
boolean | false |
Let the two connected bodies collide with each other. |
joint.mouse.target |
vec2 | (0, 0) |
World point the body is pulled to (px). Range 0 to 1280. |
joint.mouse.hertz |
number | 4 |
Stiffness of the pull (Hz). Range 0.1 to 60. |
joint.mouse.dampingRatio |
number | 1 |
Damping of the pull: 1 = no overshoot. Range 0 to 10. |
joint.mouse.maxForce |
number | 1000 |
Strongest pull applied. Range 0 to 50000. |
joint.mouse.collideConnected |
boolean | false |
Let the two connected bodies collide with each other. |
joint.prismatic.localAnchorA |
vec2 | (0, 0) |
Anchor on body A, relative to its origin (px). Range -500 to 500. |
joint.prismatic.localAnchorB |
vec2 | (0, 0) |
Anchor on body B, relative to its origin (px). Range -500 to 500. |
joint.prismatic.localAxisA |
vec2 | (1, 0) |
Direction body B slides along, in body A’s space. Range -1 to 1. |
joint.prismatic.referenceAngle |
number | 0 |
Body B’s angle relative to body A that counts as zero (degrees). Range 0 to 360. |
joint.prismatic.targetTranslation |
number | 0 |
Position the spring pulls to along the axis (px). Range -500 to 500. |
joint.prismatic.enableSpring |
boolean | false |
Make the joint springy instead of rigid. |
joint.prismatic.hertz |
number | 4 |
Spring stiffness as an oscillation frequency (Hz); 0 = no spring. Range 0 to 60. |
joint.prismatic.dampingRatio |
number | 0.5 |
Spring damping: 0 bounces forever, 1 settles without overshoot. Range 0 to 10. |
joint.prismatic.enableLimit |
boolean | false |
Clamp the joint’s travel to the lower / upper limits. |
joint.prismatic.lowerTranslation |
number | -100 |
Furthest back along the axis (px; with the limit on). Range -500 to 500. |
joint.prismatic.upperTranslation |
number | 100 |
Furthest forward along the axis (px; with the limit on). Range -500 to 500. |
joint.prismatic.enableMotor |
boolean | false |
Drive the joint at Motor Speed, up to the maximum force / torque. |
joint.prismatic.maxMotorForce |
number | 100000 |
Strongest push the motor applies (pixel-scale bodies are heavy). Range 0 to 1e+08. |
joint.prismatic.motorSpeed |
number | 0 |
Sliding speed the motor drives (px/s). Range -500 to 500. |
joint.prismatic.collideConnected |
boolean | false |
Let the two connected bodies collide with each other. |
joint.revolute.localAnchorA |
vec2 | (0, 0) |
Anchor on body A, relative to its origin (px). Range -500 to 500. |
joint.revolute.localAnchorB |
vec2 | (0, 0) |
Anchor on body B, relative to its origin (px). Range -500 to 500. |
joint.revolute.referenceAngle |
number | 0 |
Body B’s angle relative to body A that counts as zero (degrees). Range 0 to 360. |
joint.revolute.targetAngle |
number | 0 |
Angle the spring pulls to (degrees). Range -360 to 360. |
joint.revolute.enableSpring |
boolean | false |
Make the joint springy instead of rigid. |
joint.revolute.hertz |
number | 4 |
Spring stiffness as an oscillation frequency (Hz); 0 = no spring. Range 0 to 60. |
joint.revolute.dampingRatio |
number | 0.5 |
Spring damping: 0 bounces forever, 1 settles without overshoot. Range 0 to 10. |
joint.revolute.enableLimit |
boolean | false |
Clamp the joint’s travel to the lower / upper limits. |
joint.revolute.lowerAngle |
number | -45 |
Smallest angle (degrees; with the limit on). Range -360 to 360. |
joint.revolute.upperAngle |
number | 45 |
Largest angle (degrees; with the limit on). Range -360 to 360. |
joint.revolute.enableMotor |
boolean | false |
Drive the joint at Motor Speed, up to the maximum force / torque. |
joint.revolute.maxMotorTorque |
number | 5000000 |
Strongest twist the motor applies (pixel-scale bodies are heavy). Range 0 to 1e+08. |
joint.revolute.motorSpeed |
number | 0 |
Spin speed the motor drives (radians/s). Range -50 to 50. |
joint.revolute.collideConnected |
boolean | false |
Let the two connected bodies collide with each other. |
joint.weld.localAnchorA |
vec2 | (0, 0) |
Anchor on body A, relative to its origin (px). Range -500 to 500. |
joint.weld.localAnchorB |
vec2 | (0, 0) |
Anchor on body B, relative to its origin (px). Range -500 to 500. |
joint.weld.referenceAngle |
number | 0 |
Body B’s angle relative to body A that counts as zero (degrees). Range 0 to 360. |
joint.weld.linearHertz |
number | 0 |
Positional softness (Hz); 0 = rigid. Range 0 to 60. |
joint.weld.angularHertz |
number | 0 |
Angular softness (Hz); 0 = rigid. Range 0 to 60. |
joint.weld.linearDampingRatio |
number | 0 |
Damping of the positional softness. Range 0 to 10. |
joint.weld.angularDampingRatio |
number | 0 |
Damping of the angular softness. Range 0 to 10. |
joint.weld.collideConnected |
boolean | false |
Let the two connected bodies collide with each other. |
joint.wheel.localAnchorA |
vec2 | (0, 0) |
Anchor on body A, relative to its origin (px). Range -500 to 500. |
joint.wheel.localAnchorB |
vec2 | (0, 0) |
Anchor on body B, relative to its origin (px). Range -500 to 500. |
joint.wheel.localAxisA |
vec2 | (0, 1) |
Suspension direction, in body A’s space. Range -1 to 1. |
joint.wheel.enableSpring |
boolean | true |
Springy suspension along the axis. |
joint.wheel.hertz |
number | 1 |
Spring stiffness as an oscillation frequency (Hz); 0 = no spring. Range 0 to 60. |
joint.wheel.dampingRatio |
number | 0.7 |
Spring damping: 0 bounces forever, 1 settles without overshoot. Range 0 to 10. |
joint.wheel.enableLimit |
boolean | false |
Clamp the joint’s travel to the lower / upper limits. |
joint.wheel.lowerTranslation |
number | -50 |
Suspension’s lowest travel (px; with the limit on). Range -500 to 500. |
joint.wheel.upperTranslation |
number | 50 |
Suspension’s highest travel (px; with the limit on). Range -500 to 500. |
joint.wheel.enableMotor |
boolean | false |
Drive the joint at Motor Speed, up to the maximum force / torque. |
joint.wheel.maxMotorTorque |
number | 5000000 |
Strongest twist the wheel motor applies (pixel-scale bodies are heavy). Range 0 to 1e+08. |
joint.wheel.motorSpeed |
number | 0 |
Wheel spin speed the motor drives (radians/s). Range -50 to 50. |
joint.wheel.collideConnected |
boolean | false |
Let the two connected bodies collide with each other. |
debugColor |
color | #facc15ff |
Colour of the line drawn between the anchors. |
Plus the common properties every node has.
Lua methods
Section titled “Lua methods”Call them on the node (self.node in its script, or self.node:get_node("path")). Every node also has the Node methods.
JointNode:get_property(path)
Section titled “JointNode:get_property(path)”Reads an Inspector property by its path (vectors and colours as tables); “script.
local value = self.node:get_property("debugColor")pathJointNodeProperty|string
Returns any
JointNode:set_property(path, value, y)
Section titled “JointNode:set_property(path, value, y)”Sets an Inspector property by its path: vectors as {x, y} or x, y; colours as {r, g, b[, a]} 0..1 or “#rrggbb[aa]”; enums by name; “script.
self.node:set_property("debugColor", "#ff8800")pathJointNodeProperty|stringvalueanyy?number
In a scene file
Section titled “In a scene file”{ "type": "JointNode", "name": "Joint", "position": [ 0, 0 ], "properties": { "debugColor": "#facc15ff" }}