Class PhysicalBone3D
- Namespace
- Godot
- Assembly
- GodotSharp.dll
The PhysicalBone3D node is a physics body that can be used to make bones in a Skeleton3D react to physics.
public class PhysicalBone3D : PhysicsBody3D, IDisposable
- Inheritance
-
PhysicalBone3D
- Implements
- Inherited Members
Constructors
PhysicalBone3D()
public PhysicalBone3D()
Properties
AngularDamp
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 Area3D the body is in. Depending on AngularDampMode, you can set AngularDamp to be added to or to replace the body's damping value.
See ProjectSettings.physics/3d/default_angular_damp
for more details about damping.
public float AngularDamp { get; set; }
Property Value
AngularDampMode
Defines how AngularDamp is applied. See PhysicalBone3D.DampMode for possible values.
public PhysicalBone3D.DampMode AngularDampMode { get; set; }
Property Value
AngularVelocity
The PhysicalBone3D's rotational velocity in radians per second.
public Vector3 AngularVelocity { get; set; }
Property Value
BodyOffset
Sets the body's transform.
public Transform3D BodyOffset { get; set; }
Property Value
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
, LinearDampMode to Replace, LinearDamp to 0.0
, AngularDampMode to Replace, and AngularDamp to 0.0
.
public float Bounce { get; set; }
Property Value
CanSleep
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.
public bool CanSleep { get; set; }
Property Value
CustomIntegrator
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 _IntegrateForces(PhysicsDirectBodyState3D) function, if defined.
public bool CustomIntegrator { get; set; }
Property Value
Friction
The body's friction, from 0
(frictionless) to 1
(max friction).
public float Friction { get; set; }
Property Value
GravityScale
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.
public float GravityScale { get; set; }
Property Value
JointOffset
Sets the joint's transform.
public Transform3D JointOffset { get; set; }
Property Value
JointRotation
Sets the joint's rotation in radians.
public Vector3 JointRotation { get; set; }
Property Value
JointType
Sets the joint type. See PhysicalBone3D.JointTypeEnum for possible values.
public PhysicalBone3D.JointTypeEnum JointType { get; set; }
Property Value
LinearDamp
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 Area3D the body is in. Depending on LinearDampMode, you can set LinearDamp to be added to or to replace the body's damping value.
See ProjectSettings.physics/3d/default_linear_damp
for more details about damping.
public float LinearDamp { get; set; }
Property Value
LinearDampMode
Defines how LinearDamp is applied. See PhysicalBone3D.DampMode for possible values.
public PhysicalBone3D.DampMode LinearDampMode { get; set; }
Property Value
LinearVelocity
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 _IntegrateForces(PhysicsDirectBodyState3D) as your process loop for precise control of the body state.
public Vector3 LinearVelocity { get; set; }
Property Value
Mass
The body's mass.
public float Mass { get; set; }
Property Value
Methods
ApplyCentralImpulse(Vector3)
public void ApplyCentralImpulse(Vector3 impulse)
Parameters
impulse
Vector3
ApplyImpulse(Vector3, Vector3?)
public void ApplyImpulse(Vector3 impulse, Vector3? position = null)
Parameters
impulse
Vector3position
Vector3?If the parameter is null, then the default value is
new Vector3(0, 0, 0)
.
GetBoneId()
public int GetBoneId()
Returns
GetSimulatePhysics()
public bool GetSimulatePhysics()
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
IsSimulatingPhysics()
public bool IsSimulatingPhysics()
Returns
_IntegrateForces(PhysicsDirectBodyState3D)
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 CustomIntegrator property allows you to disable the default behavior and do fully custom force integration for a body.
public virtual void _IntegrateForces(PhysicsDirectBodyState3D state)
Parameters
state
PhysicsDirectBodyState3D