Table of Contents

Class PhysicalBone3D

A physics body used to make bones in a Skeleton3D react to physics.

Inheritance
PhysicalBone3D

Remarks

The PhysicalBone3D node is a physics body that can be used to make bones in a Skeleton3D react to physics.

Note: In order to detect physical bones with raycasts, the active property of the parent PhysicalBoneSimulator3D must be true and the Skeleton3D's bone must be assigned to PhysicalBone3D correctly; it means that get_bone_id should return a valid id (>= 0).

Properties

angular_damp

Damps the body's rotation. By default, the body will use the physics/3d/default_angular_damp project setting or any value override set by an Area3D the body is in. Depending on angular_damp_mode, you can set angular_damp to be added to or to replace the body's damping value.

See physics/3d/default_angular_damp for more details about damping.

var angular_damp : float = 0.0

Property Value

float

Remarks

  • void set_angular_damp(float value)
  • float get_angular_damp

angular_damp_mode

Defines how angular_damp is applied. See DampMode for possible values.

var angular_damp_mode : int = 0

Property Value

int

Remarks

  • void set_angular_damp_mode(int value)
  • int get_angular_damp_mode

angular_velocity

The PhysicalBone3D's rotational velocity in radians per second.

var angular_velocity : Vector3 = Vector3(0, 0, 0)

Property Value

Vector3

Remarks

  • void set_angular_velocity(Vector3 value)
  • Vector3 get_angular_velocity

body_offset

Sets the body's transform.

var body_offset : Transform3D = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)

Property Value

Transform3D

Remarks

bounce

The body's bounciness. Values range from 0 (no bounce) to 1 (full bounciness).

Note: Even with bounce set to 1.0, some energy will be lost over time due to linear and angular damping. To have a PhysicalBone3D that preserves all its energy over time, set bounce to 1.0, linear_damp_mode to PhysicalBone3D.DAMP_MODE_REPLACE, linear_damp to 0.0, angular_damp_mode to PhysicalBone3D.DAMP_MODE_REPLACE, and angular_damp to 0.0.

var bounce : float = 0.0

Property Value

float

Remarks

can_sleep

If true, the body is deactivated when there is no movement, so it will not take part in the simulation until it is awakened by an external force.

var can_sleep : bool = true

Property Value

bool

Remarks

  • void set_can_sleep(bool value)
  • bool is_able_to_sleep

custom_integrator

If true, the standard force integration (like gravity or damping) will be disabled for this body. Other than collision response, the body will only move as determined by the PhysicalBone3D._integrate_forces method, if that virtual method is overridden.

Setting this property will call the method PhysicsServer3D.body_set_omit_force_integration internally.

var custom_integrator : bool = false

Property Value

bool

Remarks

  • void set_use_custom_integrator(bool value)
  • bool is_using_custom_integrator

friction

The body's friction, from 0 (frictionless) to 1 (max friction).

var friction : float = 1.0

Property Value

float

Remarks

  • void set_friction(float value)
  • float get_friction

gravity_scale

This is multiplied by physics/3d/default_gravity to produce this body's gravity. For example, a value of 1.0 will apply normal gravity, 2.0 will apply double the gravity, and 0.5 will apply half the gravity to this body.

var gravity_scale : float = 1.0

Property Value

float

Remarks

  • void set_gravity_scale(float value)
  • float get_gravity_scale

joint_offset

Sets the joint's transform.

var joint_offset : Transform3D = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)

Property Value

Transform3D

Remarks

joint_rotation

Sets the joint's rotation in radians.

var joint_rotation : Vector3 = Vector3(0, 0, 0)

Property Value

Vector3

Remarks

joint_type

Sets the joint type. See JointType for possible values.

var joint_type : int = 0

Property Value

int

Remarks

  • void set_joint_type(int value)
  • int get_joint_type

linear_damp

Damps the body's movement. By default, the body will use physics/3d/default_linear_damp or any value override set by an Area3D the body is in. Depending on linear_damp_mode, linear_damp may be added to or replace the body's damping value.

See physics/3d/default_linear_damp for more details about damping.

var linear_damp : float = 0.0

Property Value

float

Remarks

  • void set_linear_damp(float value)
  • float get_linear_damp

linear_damp_mode

Defines how linear_damp is applied. See DampMode for possible values.

var linear_damp_mode : int = 0

Property Value

int

Remarks

  • void set_linear_damp_mode(int value)
  • int get_linear_damp_mode

linear_velocity

The body's linear velocity in units per second. Can be used sporadically, but don't set this every frame, because physics may run in another thread and runs at a different granularity. Use PhysicalBone3D._integrate_forces as your process loop for precise control of the body state.

var linear_velocity : Vector3 = Vector3(0, 0, 0)

Property Value

Vector3

Remarks

mass

The body's mass.

var mass : float = 1.0

Property Value

float

Remarks

Methods

_integrate_forces(PhysicsDirectBodyState3D)

Qualifiers: virtual

Called during physics processing, allowing you to read and safely modify the simulation state for the object. By default, it is called before the standard force integration, but the custom_integrator property allows you to disable the standard force integration and do fully custom force integration for a body.

void _integrate_forces(PhysicsDirectBodyState3D state)

Parameters

state PhysicsDirectBodyState3D

apply_central_impulse(Vector3)

Applies a directional impulse without affecting rotation.

An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_integrate_forces" functions otherwise).

This is equivalent to using PhysicalBone3D.apply_impulse at the body's center of mass.

void apply_central_impulse(Vector3 impulse)

Parameters

impulse Vector3

apply_impulse(Vector3, Vector3)

Applies a positioned impulse to the PhysicsBone3D.

An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_integrate_forces" functions otherwise).

position is the offset from the PhysicsBone3D origin in global coordinates.

void apply_impulse(Vector3 impulse, Vector3 position)

Parameters

impulse Vector3
position Vector3

get_bone_id

Qualifiers: const

Returns the unique identifier of the PhysicsBone3D.

int get_bone_id

get_simulate_physics

Returns true if the PhysicsBone3D is allowed to simulate physics.

bool get_simulate_physics

is_simulating_physics

Returns true if the PhysicsBone3D is currently simulating physics.

bool is_simulating_physics