Up to date

This page is up to date for Godot 4.3. If you still find outdated information, please open an issue.

Joint2D

Inherits: Node2D < CanvasItem < Node < Object

Inherited By: DampedSpringJoint2D, GrooveJoint2D, PinJoint2D

Abstract base class for all 2D physics joints.

Description

Abstract base class for all joints in 2D physics. 2D joints bind together two physics bodies (node_a and node_b) and apply a constraint.

Properties

float

bias

0.0

bool

disable_collision

true

DisableMode

disable_mode

0

NodePath

node_a

NodePath("")

NodePath

node_b

NodePath("")

Methods

RID

get_rid() const


Enumerations

enum DisableMode: 🔗

DisableMode DISABLE_MODE_REMOVE = 0

When Node.process_mode is set to Node.PROCESS_MODE_DISABLED, remove from the physics simulation to stop all physics interactions with this Joint2D.

Automatically re-added to the physics simulation when the Node is processed again with initial transforms for bodies.

DisableMode DISABLE_MODE_KEEP_ACTIVE = 1

When Node.process_mode is set to Node.PROCESS_MODE_DISABLED, do not affect the physics simulation.


Property Descriptions

float bias = 0.0 🔗

When node_a and node_b move in different directions the bias controls how fast the joint pulls them back to their original position. The lower the bias the more the two bodies can pull on the joint.

When set to 0, the default value from ProjectSettings.physics/2d/solver/default_constraint_bias is used.


bool disable_collision = true 🔗

  • void set_exclude_nodes_from_collision(value: bool)

  • bool get_exclude_nodes_from_collision()

If true, the two bodies bound together do not collide with each other.


DisableMode disable_mode = 0 🔗

Defines the behavior in physics when Node.process_mode is set to Node.PROCESS_MODE_DISABLED. See DisableMode for more details about the different modes.


NodePath node_a = NodePath("") 🔗

Path to the first body (A) attached to the joint. The node must inherit PhysicsBody2D.


NodePath node_b = NodePath("") 🔗

Path to the second body (B) attached to the joint. The node must inherit PhysicsBody2D.


Method Descriptions

RID get_rid() const 🔗

Returns the joint's internal RID from the PhysicsServer2D.