Realot StudioDocs
Components

Joint2D

Realot Studio Joint2D component reference: fields, script API, behavior and examples.

View as Markdownllms.txt
ScopeThis page documents the Joint2D component in Realot Studio. Runtime fields are serialized scene data; the Script API section lists only members intentionally exposed to game scripts.
Where to find it in the editorInspector → Add Component → Joint 2D; choose Fixed/Revolute/Prismatic/Rope/Spring and configure anchors/limits/motor.

#What it does

Connect physics bodies with Fixed, Revolute, Prismatic, Rope or Spring constraints.

Component setup & editor toolsJoint2D constrains one physics body relative to another and requires compatible Rigidbody2D setup.

#How to add and use Joint2D

Editor path: Select the target entity in the Hierarchy (left side) → look at the Inspector (right side) → click Add Component at the bottom of the Inspector → search for Joint2D → click the component row. The Add Component picker is a centered modal with a search box; it only lists components not already attached.

For components with a dedicated editor tool, the tool is opened or activated from the location described below. Do not assume that adding the component alone activates its editor; some systems require a separate window, panel, or viewport tool.

#Component setup & editor tools

  • Select entity → Inspector → Add Component → Joint 2D. Configure the joint from its Inspector section and make sure the connected physics bodies satisfy the joint’s requirements.

#What you should see after adding it

The component appears as its own section in the Inspector. Its serialized settings are listed in the Component data table below. If a field is conditional, it appears only when the relevant mode/type is selected. If a field is a runtime state field (for example grounded or resolved velocity), treat it as read-only diagnostic state unless the API reference explicitly documents it as writable.

#How to read the settings

For every setting below, the documentation distinguishes type, default, meaning, and tuning direction where behavior is known. When a value represents a direction, use the engine's coordinate convention documented in Coordinate system; do not substitute Unity/Godot conventions.

#Component data

FieldTypePurposeDefault
jointTypeJointType2D enum: Fixed | Revolute | Prismatic | Rope | SpringFixed | Revolute | Prismatic | Rope | Spring.Revolute
connectedEntityIdnullable valuenull = jointed to a fixed point in the world instead of another body.null
anchor1XnumberLocal-space anchor points, in pixels — see class doc comment.0
anchor1YnumberLocal anchor Y on this entity.0
anchor2XnumberLocal anchor X on the connected body/world anchor.0
anchor2YnumberLocal anchor Y on the connected body/world anchor.0
axisXnumberPrismatic only: slide axis, local to body1.1
axisYnumberPrismatic axis Y.0
lengthnumberRope: total physical link-path length of the rope.100
stiffnessnumberSpring only. Note these are NOT the small "intuitive" values a spring might use in an SI/meters engine — Rapier computes spring force from anchor distance in METERS (via World.lengthUnit, see PhysicsWorld.js's LENGTH_UNIT_PX_PER_METER = 100), so at this engine's pixel scale a rest-length-50px displacement is only…6000
dampingnumberSpring damping.18
flexibilitynumberRevolute only: how freely the connected body may rotate.100
segmentCountnumberFlexible Rope/Spring physical structure.18
ropeMassnumberMass per rope/spring segment.0.5
visualEnabledbooleanRuntime rope/string visualization.true
visualColorhex color stringJoint/rope visual color.#c8a66a
visualThicknessnumberVisual thickness.3
useTexturebooleanOptional image texture running along the rope/string instead of a flat color line — same texture/mode vocabulary as StrokePath (see runtime/components/StrokePath.js), so anyone who has textured a StrokePath already recognizes these fields.false
textureKeynullable valueTexture asset key.null
textureModestring"stretch": the whole image is squeezed/stretched to fit the rope's current length end-to-end — warps as the rope swings and its chord length changes.stretch
textureTilingnumberTiling length.32
textureScalenumberTexture scale.1
textureOffsetnumberTexture offset.0
textureFlipbooleanFlip texture.false
limitsEnabledbooleanRevolute + Prismatic: optional min/max limit on the joint's one free coordinate (degrees for Revolute, pixels for Prismatic).false
limitMinnumberMinimum limit.-45
limitMaxnumberMaximum limit.45
motorEnabledbooleanRevolute + Prismatic: optional motor driving that same free coordinate.false
motorSpeednumberMotor target speed.0
motorMaxForcenumberMaximum motor force.0
jointDragnumberRevolute-only passive rotational response.0
restStiffnessnumberInspector field stored on this component.0
breakablebooleanRevolute-only structural failure.false
breakForcenumberInspector field stored on this component.10000
disableConnectedCollisionbooleanWhen enabled, only this joint's two connected entities stop generating contact pairs with one another.false
collideConnectedvalueLegacy scene/script field.undefined
enabledbooleanEditor/gizmo convenience only — never read by PhysicsWorld.true

#Tuning behavior

These are the practical direction-of-change rules for the most important controls on this component.

SettingWhat changing it does
lengthFor Rope/Spring, higher length increases the rest/maximum link distance depending on the joint type.
stiffnessFor Spring, higher values pull toward the rest length more strongly.
dampingHigher damping reduces oscillation faster.
segmentCountRope visual/solver subdivision count; higher can look smoother but costs more.

#Breakable joints and drag

  • breakable / breakForce (Revolute only): when the joint load exceeds breakForce the joint snaps apart. Script joint.breakable and joint.breakForce.
  • jointDrag and restStiffness (Revolute only): drag/damping and the springiness that pulls the joint back to its rest pose.
  • disableConnectedCollision: stop the two connected bodies from colliding with each other. It replaces the old collideConnected field, which is kept only for loading older projects.
Script API note:JointAPI currently lists flexibility in its proxy allow-list, but the script object has no getter or setter for it. Reading it returns undefined, and writing it does not change the component. Set Flexibility (%) in the Inspector.

#Script API

MemberKindDescription
anchor1Property (read/write){x,y} local anchor on this body.
anchor2Property (read/write){x,y} local anchor on connected body/world anchor.
axisProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
breakForceProperty (read/write)Exposed by this script module.
breakableProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
collideConnectedProperty (read/write)Collision between connected bodies.
connectedEntityProperty (read/write)Connected entity context, when one exists.
dampingProperty (read/write)Spring damping.
disableConnectedCollisionProperty (read/write)Exposed by this script module.
enabledProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
flexibilityAllow-listed but not implementedThe JointAPI allow-list contains this name, but no getter or setter is implemented. Reads return undefined and writes do not update Joint2D.flexibility. Set Flexibility (%) in the Inspector instead.
jointDragProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
jointTypeProperty (read/write)Joint type.
lengthProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
limitMaxProperty (read/write)Maximum limit.
limitMinProperty (read/write)Minimum limit.
limitsEnabledProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
motorEnabledProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
motorMaxForceProperty (read/write)Maximum motor force.
motorSpeedProperty (read/write)Motor speed.
restStiffnessProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
ropeMassProperty (read/write)Rope/spring segment mass.
segmentCountProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
stiffnessProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
textureFlipProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
textureKeyProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
textureModeProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
textureOffsetProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
textureScaleProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
textureTilingProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
useTextureProperty (read/write)The `this.joint` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
visualColorProperty (read/write)Visual color.
visualEnabledProperty (read/write)Visual enabled.
visualThicknessProperty (read/write)Visual thickness.

#Examples

js
this.joint.connectedEntity = findFirst("Target");
js
this.joint.jointType = "Spring";
Need the full workflow?Components: complete workflow covers adding, configuring, testing, combining, and removing components.