Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
PhysicalBone3D
繼承: PhysicsBody3D < CollisionObject3D < Node3D < Node < Object
用於讓 Skeleton3D 中的骨骼對物理作出反應的物理體。
說明
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 SkeletonModifier3D.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).
教學
屬性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
方法
void |
_integrate_forces(state: PhysicsDirectBodyState3D) virtual |
void |
apply_central_impulse(impulse: Vector3) |
void |
apply_impulse(impulse: Vector3, position: Vector3 = Vector3(0, 0, 0)) |
get_bone_id() const |
|
列舉
enum DampMode: 🔗
DampMode DAMP_MODE_COMBINE = 0
在這種模式下,物體的阻尼值將被加到區域中設定的任何值或預設值。
DampMode DAMP_MODE_REPLACE = 1
在這種模式下,物體的阻尼值將替換掉區域中設定的任何值或預設值。
enum JointType: 🔗
JointType JOINT_TYPE_NONE = 0
No joint is applied to the PhysicsBone3D.
JointType JOINT_TYPE_PIN = 1
A pin joint is applied to the PhysicsBone3D.
JointType JOINT_TYPE_CONE = 2
A cone joint is applied to the PhysicsBone3D.
JointType JOINT_TYPE_HINGE = 3
A hinge joint is applied to the PhysicsBone3D.
JointType JOINT_TYPE_SLIDER = 4
A slider joint is applied to the PhysicsBone3D.
JointType JOINT_TYPE_6DOF = 5
A 6 degrees of freedom joint is applied to the PhysicsBone3D.
屬性說明
Damps the body's rotation. By default, the body will use the ProjectSettings.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 ProjectSettings.physics/3d/default_angular_damp for more details about damping.
DampMode angular_damp_mode = 0 🔗
Defines how angular_damp is applied.
Vector3 angular_velocity = Vector3(0, 0, 0) 🔗
該 PhysicalBone3D 的旋轉速度,以每秒弧度為單位。
Transform3D body_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) 🔗
void set_body_offset(value: Transform3D)
Transform3D get_body_offset()
設定該物體的變換。
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 DAMP_MODE_REPLACE, linear_damp to 0.0, angular_damp_mode to DAMP_MODE_REPLACE, and angular_damp to 0.0.
如果為 true,則會在不移動時停用該物體,所以它在被外力喚醒前不會參與模擬。
bool custom_integrator = false 🔗
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 _integrate_forces() method, if that virtual method is overridden.
Setting this property will call the method PhysicsServer3D.body_set_omit_force_integration() internally.
該物體的摩擦,從 0(無摩擦)到 1(最大摩擦)。
This is multiplied by ProjectSettings.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.
Transform3D joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) 🔗
void set_joint_offset(value: Transform3D)
Transform3D get_joint_offset()
設定該關節的變換。
Vector3 joint_rotation = Vector3(0, 0, 0) 🔗
設定該關節的旋轉,單位為弧度。
Sets the joint type.
Damps the body's movement. By default, the body will use ProjectSettings.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 ProjectSettings.physics/3d/default_linear_damp for more details about damping.
DampMode linear_damp_mode = 0 🔗
Defines how linear_damp is applied.
Vector3 linear_velocity = Vector3(0, 0, 0) 🔗
物體的線速度,單位為單位每秒。可以偶爾使用,但是不要每一影格都設定它,因為物理可能在另一個執行緒中運作,並且以不同的間隔。使用 _integrate_forces() 作為你的程序迴圈,以精確控制物體狀態。
此實體的質量。
方法說明
void _integrate_forces(state: PhysicsDirectBodyState3D) 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 apply_central_impulse(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 apply_impulse() at the body's center of mass.
void apply_impulse(impulse: Vector3, position: Vector3 = Vector3(0, 0, 0)) 🔗
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.
Returns the unique identifier of the PhysicsBone3D.
Returns true if the PhysicsBone3D is allowed to simulate physics.
bool is_simulating_physics() 🔗
Returns true if the PhysicsBone3D is currently simulating physics.