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...
PhysicalBone2D
继承: RigidBody2D < PhysicsBody2D < CollisionObject2D < Node2D < CanvasItem < Node < Object
派生自 RigidBody2D 的节点,用于让 Skeleton2D 中的 Bone2D 对物理作出反应。
描述
PhysicalBone2D 节点基于 RigidBody2D,可以用来使 Skeleton2D 中的 Bone2D 节点对物理作出反应。
注意:为了让 Bone2D 节点在视觉上跟随 PhysicalBone2D 节点,请在父级 Skeleton2D 节点上使用 SkeletonModification2DPhysicalBones 修改。
注意:PhysicalBone2D 节点不会自动创建 Joint2D 节点来让 PhysicalBone2D 节点保持在一起。你需要手动创建这些节点。大多数情况下,你想要使用的都是 PinJoint2D 节点。创建 PhysicalBone2D 子节点后会自动配置 Joint2D 节点。
属性
|
||
|
||
|
||
|
||
|
方法
get_joint() const |
|
is_simulating_physics() const |
属性说明
bool auto_configure_joint = true
🔗
如果为 true
,PhysicalBone2D 节点会自动配置第一个 Joint2D 子节点。自动配置仅限于设置节点属性和定位该 Joint2D。
该 PhysicalBone2D 节点所模拟的 Bone2D 节点的索引。
NodePath bone2d_nodepath = NodePath("")
🔗
该 PhysicalBone2D 所模拟的 Bone2D 的 NodePath。
bool follow_bone_when_simulating = false
🔗
如果为 true
,则该 PhysicalBone2D 在模拟物理时会保持其绑定的骨骼的变换。
bool simulate_physics = false
🔗
如果为 true
,PhysicalBone2D 将开始使用物理进行模拟。如果为 false
,PhysicalBone2D 将跟随 Bone2D 节点的变换。
注意:要使 Bone2D 节点在视觉上跟随 PhysicalBone2D 节点,请在具有 Bone2D 节点的 Skeleton2D 节点上使用一个 SkeletonModification2DPhysicalBones 修改。
方法说明
如果存在,则返回第一个 Joint2D 子节点。主要是辅助函数,用于简化对 PhysicalBone2D 所自动配置的 Joint2D 的获取。
bool is_simulating_physics() const 🔗
返回一个布尔值,表示 PhysicalBone2D 节点是否处于运行状态,正在使用 Godot 2D 物理引擎进行仿真。为 true
时,该 PhysicalBone2D 节点正在使用物理。