Skip to content

HingeJoint3D

Inherits: Joint3D < Entity3D < Entity < Object

A physics joint that restricts the rotation of a 3D physics body around an axis relative to another physics body.

A physics joint that restricts the rotation of a 3D physics body around an axis relative to another physics body. For example, Body A can be a StaticBody3D representing a door hinge that a RigidBody3D rotates around.

Type Name Default
float angular_limit/bias 0.3
bool angular_limit/enable false
float angular_limit/lower -1.5707964
float angular_limit/relaxation 1.0
float angular_limit/upper 1.5707964
bool motor/enable false
float motor/max_impulse 1.0
float motor/target_velocity 1.0
float params/bias 0.3
Returns Method
bool get_flag(flag: Flag) const
float get_param(param: Param) const
void set_flag(flag: Flag, enabled: bool)
void set_param(param: Param, value: float)

Param

enum Param

PARAM_BIAS = 0

The speed with which the two bodies get pulled together when they move in different directions.

PARAM_LIMIT_UPPER = 1

The maximum rotation. Only active if angular_limit/enable is true.

PARAM_LIMIT_LOWER = 2

The minimum rotation. Only active if angular_limit/enable is true.

PARAM_LIMIT_BIAS = 3

The speed with which the rotation across the axis perpendicular to the hinge gets corrected.

PARAM_LIMIT_RELAXATION = 5

The lower this value, the more the rotation gets slowed down.

PARAM_MOTOR_TARGET_VELOCITY = 6

Target speed for the motor.

PARAM_MOTOR_MAX_IMPULSE = 7

Maximum acceleration for the motor.

PARAM_MAX = 8

Represents the size of the Param enum.

Flag

enum Flag

FLAG_USE_LIMIT = 0

If true, the hinges maximum and minimum rotation, defined by angular_limit/lower and angular_limit/upper has effects.

FLAG_ENABLE_MOTOR = 1

When activated, a motor turns the hinge.

FLAG_MAX = 2

Represents the size of the Flag enum.

angular_limit/bias

float angular_limit/bias = 0.3

The speed with which the rotation across the axis perpendicular to the hinge gets corrected.

angular_limit/enable

bool angular_limit/enable = false

If true, the hinges maximum and minimum rotation, defined by angular_limit/lower and angular_limit/upper has effects.

angular_limit/lower

float angular_limit/lower = -1.5707964

The minimum rotation. Only active if angular_limit/enable is true.

angular_limit/relaxation

float angular_limit/relaxation = 1.0

The lower this value, the more the rotation gets slowed down.

angular_limit/upper

float angular_limit/upper = 1.5707964

The maximum rotation. Only active if angular_limit/enable is true.

motor/enable

bool motor/enable = false

When activated, a motor turns the hinge.

motor/max_impulse

float motor/max_impulse = 1.0

Maximum acceleration for the motor.

motor/target_velocity

float motor/target_velocity = 1.0

Target speed for the motor.

params/bias

float params/bias = 0.3

The speed with which the two bodies get pulled together when they move in different directions.

get_flag

bool get_flag(flag: Flag) const

Returns the value of the specified flag.

get_param

float get_param(param: Param) const

Returns the value of the specified parameter.

set_flag

void set_flag(flag: Flag, enabled: bool)

If true, enables the specified flag.

set_param

void set_param(param: Param, value: float)

Sets the value of the specified parameter.