Skip to content

Latest commit

 

History

History
551 lines (309 loc) · 23.7 KB

class_physicalbone3d.rst

File metadata and controls

551 lines (309 loc) · 23.7 KB
github_url:hide

PhysicalBone3D

Inherits: :ref:`PhysicsBody3D<class_PhysicsBody3D>` < :ref:`CollisionObject3D<class_CollisionObject3D>` < :ref:`Node3D<class_Node3D>` < :ref:`Node<class_Node>` < :ref:`Object<class_Object>`

A physics body used to make bones in a :ref:`Skeleton3D<class_Skeleton3D>` react to physics.

.. rst-class:: classref-introduction-group

Description

The PhysicalBone3D node is a physics body that can be used to make bones in a :ref:`Skeleton3D<class_Skeleton3D>` react to physics.

.. rst-class:: classref-reftable-group

Properties

:ref:`float<class_float>` :ref:`angular_damp<class_PhysicalBone3D_property_angular_damp>` 0.0
:ref:`DampMode<enum_PhysicalBone3D_DampMode>` :ref:`angular_damp_mode<class_PhysicalBone3D_property_angular_damp_mode>` 0
:ref:`Vector3<class_Vector3>` :ref:`angular_velocity<class_PhysicalBone3D_property_angular_velocity>` Vector3(0, 0, 0)
:ref:`Transform3D<class_Transform3D>` :ref:`body_offset<class_PhysicalBone3D_property_body_offset>` Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
:ref:`float<class_float>` :ref:`bounce<class_PhysicalBone3D_property_bounce>` 0.0
:ref:`bool<class_bool>` :ref:`can_sleep<class_PhysicalBone3D_property_can_sleep>` true
:ref:`bool<class_bool>` :ref:`custom_integrator<class_PhysicalBone3D_property_custom_integrator>` false
:ref:`float<class_float>` :ref:`friction<class_PhysicalBone3D_property_friction>` 1.0
:ref:`float<class_float>` :ref:`gravity_scale<class_PhysicalBone3D_property_gravity_scale>` 1.0
:ref:`Transform3D<class_Transform3D>` :ref:`joint_offset<class_PhysicalBone3D_property_joint_offset>` Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
:ref:`Vector3<class_Vector3>` :ref:`joint_rotation<class_PhysicalBone3D_property_joint_rotation>` Vector3(0, 0, 0)
:ref:`JointType<enum_PhysicalBone3D_JointType>` :ref:`joint_type<class_PhysicalBone3D_property_joint_type>` 0
:ref:`float<class_float>` :ref:`linear_damp<class_PhysicalBone3D_property_linear_damp>` 0.0
:ref:`DampMode<enum_PhysicalBone3D_DampMode>` :ref:`linear_damp_mode<class_PhysicalBone3D_property_linear_damp_mode>` 0
:ref:`Vector3<class_Vector3>` :ref:`linear_velocity<class_PhysicalBone3D_property_linear_velocity>` Vector3(0, 0, 0)
:ref:`float<class_float>` :ref:`mass<class_PhysicalBone3D_property_mass>` 1.0
.. rst-class:: classref-reftable-group

Methods

void :ref:`_integrate_forces<class_PhysicalBone3D_method__integrate_forces>` ( :ref:`PhysicsDirectBodyState3D<class_PhysicsDirectBodyState3D>` state ) |virtual|
void :ref:`apply_central_impulse<class_PhysicalBone3D_method_apply_central_impulse>` ( :ref:`Vector3<class_Vector3>` impulse )
void :ref:`apply_impulse<class_PhysicalBone3D_method_apply_impulse>` ( :ref:`Vector3<class_Vector3>` impulse, :ref:`Vector3<class_Vector3>` position=Vector3(0, 0, 0) )
:ref:`int<class_int>` :ref:`get_bone_id<class_PhysicalBone3D_method_get_bone_id>` ( ) |const|
:ref:`bool<class_bool>` :ref:`get_simulate_physics<class_PhysicalBone3D_method_get_simulate_physics>` ( )
:ref:`bool<class_bool>` :ref:`is_simulating_physics<class_PhysicalBone3D_method_is_simulating_physics>` ( )
.. rst-class:: classref-section-separator


.. rst-class:: classref-descriptions-group

Enumerations

.. rst-class:: classref-enumeration

enum DampMode:

.. rst-class:: classref-enumeration-constant

:ref:`DampMode<enum_PhysicalBone3D_DampMode>` DAMP_MODE_COMBINE = 0

In this mode, the body's damping value is added to any value set in areas or the default value.

.. rst-class:: classref-enumeration-constant

:ref:`DampMode<enum_PhysicalBone3D_DampMode>` DAMP_MODE_REPLACE = 1

In this mode, the body's damping value replaces any value set in areas or the default value.

.. rst-class:: classref-item-separator


.. rst-class:: classref-enumeration

enum JointType:

.. rst-class:: classref-enumeration-constant

:ref:`JointType<enum_PhysicalBone3D_JointType>` JOINT_TYPE_NONE = 0

.. rst-class:: classref-enumeration-constant

:ref:`JointType<enum_PhysicalBone3D_JointType>` JOINT_TYPE_PIN = 1

.. rst-class:: classref-enumeration-constant

:ref:`JointType<enum_PhysicalBone3D_JointType>` JOINT_TYPE_CONE = 2

.. rst-class:: classref-enumeration-constant

:ref:`JointType<enum_PhysicalBone3D_JointType>` JOINT_TYPE_HINGE = 3

.. rst-class:: classref-enumeration-constant

:ref:`JointType<enum_PhysicalBone3D_JointType>` JOINT_TYPE_SLIDER = 4

.. rst-class:: classref-enumeration-constant

:ref:`JointType<enum_PhysicalBone3D_JointType>` JOINT_TYPE_6DOF = 5

.. rst-class:: classref-section-separator


.. rst-class:: classref-descriptions-group

Property Descriptions

.. rst-class:: classref-property

:ref:`float<class_float>` angular_damp = 0.0

.. rst-class:: classref-property-setget

Damps the body's rotation. By default, the body will use the Default Angular Damp in Project > Project Settings > Physics > 3d or any value override set by an :ref:`Area3D<class_Area3D>` the body is in. Depending on :ref:`angular_damp_mode<class_PhysicalBone3D_property_angular_damp_mode>`, you can set :ref:`angular_damp<class_PhysicalBone3D_property_angular_damp>` to be added to or to replace the body's damping value.

See :ref:`ProjectSettings.physics/3d/default_angular_damp<class_ProjectSettings_property_physics/3d/default_angular_damp>` for more details about damping.

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`DampMode<enum_PhysicalBone3D_DampMode>` angular_damp_mode = 0

.. rst-class:: classref-property-setget

Defines how :ref:`angular_damp<class_PhysicalBone3D_property_angular_damp>` is applied. See :ref:`DampMode<enum_PhysicalBone3D_DampMode>` for possible values.

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`Vector3<class_Vector3>` angular_velocity = Vector3(0, 0, 0)

.. rst-class:: classref-property-setget

The PhysicalBone3D's rotational velocity in radians per second.

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`Transform3D<class_Transform3D>` body_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)

.. rst-class:: classref-property-setget

Sets the body's transform.

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`float<class_float>` bounce = 0.0

.. rst-class:: classref-property-setget

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

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`bool<class_bool>` can_sleep = true

.. rst-class:: classref-property-setget

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.

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`bool<class_bool>` custom_integrator = false

.. rst-class:: classref-property-setget

If true, internal force integration will be disabled (like gravity or air friction) for this body. Other than collision response, the body will only move as determined by the :ref:`_integrate_forces<class_PhysicalBone3D_method__integrate_forces>` function, if defined.

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`float<class_float>` friction = 1.0

.. rst-class:: classref-property-setget

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

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`float<class_float>` gravity_scale = 1.0

.. rst-class:: classref-property-setget

This is multiplied by the global 3D gravity setting found in Project > Project Settings > Physics > 3d to produce the body's gravity. For example, a value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object.

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`Transform3D<class_Transform3D>` joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)

.. rst-class:: classref-property-setget

Sets the joint's transform.

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`Vector3<class_Vector3>` joint_rotation = Vector3(0, 0, 0)

.. rst-class:: classref-property-setget

Sets the joint's rotation in radians.

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`JointType<enum_PhysicalBone3D_JointType>` joint_type = 0

.. rst-class:: classref-property-setget

Sets the joint type. See :ref:`JointType<enum_PhysicalBone3D_JointType>` for possible values.

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`float<class_float>` linear_damp = 0.0

.. rst-class:: classref-property-setget

Damps the body's movement. By default, the body will use the Default Linear Damp in Project > Project Settings > Physics > 3d or any value override set by an :ref:`Area3D<class_Area3D>` the body is in. Depending on :ref:`linear_damp_mode<class_PhysicalBone3D_property_linear_damp_mode>`, you can set :ref:`linear_damp<class_PhysicalBone3D_property_linear_damp>` to be added to or to replace the body's damping value.

See :ref:`ProjectSettings.physics/3d/default_linear_damp<class_ProjectSettings_property_physics/3d/default_linear_damp>` for more details about damping.

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`DampMode<enum_PhysicalBone3D_DampMode>` linear_damp_mode = 0

.. rst-class:: classref-property-setget

Defines how :ref:`linear_damp<class_PhysicalBone3D_property_linear_damp>` is applied. See :ref:`DampMode<enum_PhysicalBone3D_DampMode>` for possible values.

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`Vector3<class_Vector3>` linear_velocity = Vector3(0, 0, 0)

.. rst-class:: classref-property-setget

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 :ref:`_integrate_forces<class_PhysicalBone3D_method__integrate_forces>` as your process loop for precise control of the body state.

.. rst-class:: classref-item-separator


.. rst-class:: classref-property

:ref:`float<class_float>` mass = 1.0

.. rst-class:: classref-property-setget

The body's mass.

.. rst-class:: classref-section-separator


.. rst-class:: classref-descriptions-group

Method Descriptions

.. rst-class:: classref-method

void _integrate_forces ( :ref:`PhysicsDirectBodyState3D<class_PhysicsDirectBodyState3D>` state ) |virtual|

Called during physics processing, allowing you to read and safely modify the simulation state for the object. By default, it works in addition to the usual physics behavior, but the :ref:`custom_integrator<class_PhysicalBone3D_property_custom_integrator>` property allows you to disable the default behavior and do fully custom force integration for a body.

.. rst-class:: classref-item-separator


.. rst-class:: classref-method

void apply_central_impulse ( :ref:`Vector3<class_Vector3>` impulse )

There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
.. rst-class:: classref-item-separator


.. rst-class:: classref-method

void apply_impulse ( :ref:`Vector3<class_Vector3>` impulse, :ref:`Vector3<class_Vector3>` position=Vector3(0, 0, 0) )

There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
.. rst-class:: classref-item-separator


.. rst-class:: classref-method

:ref:`int<class_int>` get_bone_id ( ) |const|

There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
.. rst-class:: classref-item-separator


.. rst-class:: classref-method

:ref:`bool<class_bool>` get_simulate_physics ( )

There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
.. rst-class:: classref-item-separator


.. rst-class:: classref-method

:ref:`bool<class_bool>` is_simulating_physics ( )

There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!