| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="PhysicalBone3D" inherits="PhysicsBody3D" keywords="ragdoll" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A physics body used to make bones in a [Skeleton3D] react to physics. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | The [PhysicalBone3D] node is a physics body that can be used to make bones in a [Skeleton3D] react to physics. |
| 8 | [b]Note:[/b] In order to detect physical bones with raycasts, the [member SkeletonModifier3D.active] property of the parent [PhysicalBoneSimulator3D] must be [code]true[/code] and the [Skeleton3D]'s bone must be assigned to [PhysicalBone3D] correctly; it means that [method get_bone_id] should return a valid id ([code]>= 0[/code]). |
| 9 | </description> |
| 10 | <tutorials> |
| 11 | <link title="Ragdoll System">$DOCS_URL/tutorials/physics/ragdoll_system.html</link> |
| 12 | </tutorials> |
| 13 | <methods> |
| 14 | <method name="_integrate_forces" qualifiers="virtual"> |
| 15 | <return type="void" /> |
| 16 | <param index="0" name="state" type="PhysicsDirectBodyState3D" /> |
| 17 | <description> |
| 18 | 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 [member custom_integrator] property allows you to disable the standard force integration and do fully custom force integration for a body. |
| 19 | </description> |
| 20 | </method> |
| 21 | <method name="apply_central_impulse"> |
| 22 | <return type="void" /> |
| 23 | <param index="0" name="impulse" type="Vector3" /> |
| 24 | <description> |
| 25 | Applies a directional impulse without affecting rotation. |
| 26 | 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). |
| 27 | This is equivalent to using [method apply_impulse] at the body's center of mass. |
| 28 | </description> |
| 29 | </method> |
| 30 | <method name="apply_impulse"> |
| 31 | <return type="void" /> |
| 32 | <param index="0" name="impulse" type="Vector3" /> |
| 33 | <param index="1" name="position" type="Vector3" default="Vector3(0, 0, 0)" /> |
| 34 | <description> |
| 35 | Applies a positioned impulse to the PhysicsBone3D. |
| 36 | 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). |
| 37 | [param position] is the offset from the PhysicsBone3D origin in global coordinates. |
| 38 | </description> |
| 39 | </method> |
| 40 | <method name="get_bone_id" qualifiers="const"> |
| 41 | <return type="int" /> |
| 42 | <description> |
| 43 | Returns the unique identifier of the PhysicsBone3D. |
| 44 | </description> |
| 45 | </method> |
| 46 | <method name="get_simulate_physics"> |
| 47 | <return type="bool" /> |
| 48 | <description> |
| 49 | Returns [code]true[/code] if the PhysicsBone3D is allowed to simulate physics. |
| 50 | </description> |
| 51 | </method> |
| 52 | <method name="is_simulating_physics"> |
| 53 | <return type="bool" /> |
| 54 | <description> |
| 55 | Returns [code]true[/code] if the PhysicsBone3D is currently simulating physics. |
| 56 | </description> |
| 57 | </method> |
| 58 | </methods> |
| 59 | <members> |
| 60 | <member name="angular_damp" type="float" setter="set_angular_damp" getter="get_angular_damp" default="0.0"> |
| 61 | Damps the body's rotation. By default, the body will use the [member ProjectSettings.physics/3d/default_angular_damp] project setting or any value override set by an [Area3D] the body is in. Depending on [member angular_damp_mode], you can set [member angular_damp] to be added to or to replace the body's damping value. |
| 62 | See [member ProjectSettings.physics/3d/default_angular_damp] for more details about damping. |
| 63 | </member> |
| 64 | <member name="angular_damp_mode" type="int" setter="set_angular_damp_mode" getter="get_angular_damp_mode" enum="PhysicalBone3D.DampMode" default="0"> |
| 65 | Defines how [member angular_damp] is applied. |
| 66 | </member> |
| 67 | <member name="angular_velocity" type="Vector3" setter="set_angular_velocity" getter="get_angular_velocity" default="Vector3(0, 0, 0)"> |
| 68 | The PhysicalBone3D's rotational velocity in [i]radians[/i] per second. |
| 69 | </member> |
| 70 | <member name="body_offset" type="Transform3D" setter="set_body_offset" getter="get_body_offset" default="Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)"> |
| 71 | Sets the body's transform. |
| 72 | </member> |
| 73 | <member name="bounce" type="float" setter="set_bounce" getter="get_bounce" default="0.0"> |
| 74 | The body's bounciness. Values range from [code]0[/code] (no bounce) to [code]1[/code] (full bounciness). |
| 75 | [b]Note:[/b] Even with [member bounce] set to [code]1.0[/code], 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 [member bounce] to [code]1.0[/code], [member linear_damp_mode] to [constant DAMP_MODE_REPLACE], [member linear_damp] to [code]0.0[/code], [member angular_damp_mode] to [constant DAMP_MODE_REPLACE], and [member angular_damp] to [code]0.0[/code]. |
| 76 | </member> |
| 77 | <member name="can_sleep" type="bool" setter="set_can_sleep" getter="is_able_to_sleep" default="true"> |
| 78 | If [code]true[/code], 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. |
| 79 | </member> |
| 80 | <member name="custom_integrator" type="bool" setter="set_use_custom_integrator" getter="is_using_custom_integrator" default="false"> |
| 81 | If [code]true[/code], 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 [method _integrate_forces] method, if that virtual method is overridden. |
| 82 | Setting this property will call the method [method PhysicsServer3D.body_set_omit_force_integration] internally. |
| 83 | </member> |
| 84 | <member name="friction" type="float" setter="set_friction" getter="get_friction" default="1.0"> |
| 85 | The body's friction, from [code]0[/code] (frictionless) to [code]1[/code] (max friction). |
| 86 | </member> |
| 87 | <member name="gravity_scale" type="float" setter="set_gravity_scale" getter="get_gravity_scale" default="1.0"> |
| 88 | This is multiplied by [member ProjectSettings.physics/3d/default_gravity] to produce this body's gravity. For example, a value of [code]1.0[/code] will apply normal gravity, [code]2.0[/code] will apply double the gravity, and [code]0.5[/code] will apply half the gravity to this body. |
| 89 | </member> |
| 90 | <member name="joint_offset" type="Transform3D" setter="set_joint_offset" getter="get_joint_offset" default="Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)"> |
| 91 | Sets the joint's transform. |
| 92 | </member> |
| 93 | <member name="joint_rotation" type="Vector3" setter="set_joint_rotation" getter="get_joint_rotation" default="Vector3(0, 0, 0)"> |
| 94 | Sets the joint's rotation in radians. |
| 95 | </member> |
| 96 | <member name="joint_type" type="int" setter="set_joint_type" getter="get_joint_type" enum="PhysicalBone3D.JointType" default="0"> |
| 97 | Sets the joint type. |
| 98 | </member> |
| 99 | <member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp" default="0.0"> |
| 100 | Damps the body's movement. By default, the body will use [member ProjectSettings.physics/3d/default_linear_damp] or any value override set by an [Area3D] the body is in. Depending on [member linear_damp_mode], [member linear_damp] may be added to or replace the body's damping value. |
| 101 | See [member ProjectSettings.physics/3d/default_linear_damp] for more details about damping. |
| 102 | </member> |
| 103 | <member name="linear_damp_mode" type="int" setter="set_linear_damp_mode" getter="get_linear_damp_mode" enum="PhysicalBone3D.DampMode" default="0"> |
| 104 | Defines how [member linear_damp] is applied. |
| 105 | </member> |
| 106 | <member name="linear_velocity" type="Vector3" setter="set_linear_velocity" getter="get_linear_velocity" default="Vector3(0, 0, 0)"> |
| 107 | The body's linear velocity in units per second. Can be used sporadically, but [b]don't set this every frame[/b], because physics may run in another thread and runs at a different granularity. Use [method _integrate_forces] as your process loop for precise control of the body state. |
| 108 | </member> |
| 109 | <member name="mass" type="float" setter="set_mass" getter="get_mass" default="1.0"> |
| 110 | The body's mass. |
| 111 | </member> |
| 112 | </members> |
| 113 | <constants> |
| 114 | <constant name="DAMP_MODE_COMBINE" value="0" enum="DampMode"> |
| 115 | In this mode, the body's damping value is added to any value set in areas or the default value. |
| 116 | </constant> |
| 117 | <constant name="DAMP_MODE_REPLACE" value="1" enum="DampMode"> |
| 118 | In this mode, the body's damping value replaces any value set in areas or the default value. |
| 119 | </constant> |
| 120 | <constant name="JOINT_TYPE_NONE" value="0" enum="JointType"> |
| 121 | No joint is applied to the PhysicsBone3D. |
| 122 | </constant> |
| 123 | <constant name="JOINT_TYPE_PIN" value="1" enum="JointType"> |
| 124 | A pin joint is applied to the PhysicsBone3D. |
| 125 | </constant> |
| 126 | <constant name="JOINT_TYPE_CONE" value="2" enum="JointType"> |
| 127 | A cone joint is applied to the PhysicsBone3D. |
| 128 | </constant> |
| 129 | <constant name="JOINT_TYPE_HINGE" value="3" enum="JointType"> |
| 130 | A hinge joint is applied to the PhysicsBone3D. |
| 131 | </constant> |
| 132 | <constant name="JOINT_TYPE_SLIDER" value="4" enum="JointType"> |
| 133 | A slider joint is applied to the PhysicsBone3D. |
| 134 | </constant> |
| 135 | <constant name="JOINT_TYPE_6DOF" value="5" enum="JointType"> |
| 136 | A 6 degrees of freedom joint is applied to the PhysicsBone3D. |
| 137 | </constant> |
| 138 | </constants> |
| 139 | </class> |