PhysicalBone2D
继承: RigidBody2D
< PhysicsBody2D
< CollisionObject2D
< Node2D
< CanvasItem
< Node
< Object
A RigidBody2D
-derived node used to make Bone2D
s in a Skeleton2D
react to physics.
描述
The PhysicalBone2D node is a RigidBody2D
-based node that can be used to make Bone2D
s in a Skeleton2D
react to physics.
Note: To make the Bone2D
s visually follow the PhysicalBone2D node, use a SkeletonModification2DPhysicalBones
modification on the Skeleton2D
parent.
Note: The PhysicalBone2D node does not automatically create a Joint2D
node to keep PhysicalBone2D nodes together. They must be created manually. For most cases, you want to use a PinJoint2D
node. The PhysicalBone2D node will automatically configure the Joint2D
node once it's been added as a child node.
属性
bool | auto_configure_joint |
int | bone2d_index |
NodePath | bone2d_nodepath |
bool | follow_bone_when_simulating |
bool | simulate_physics |
方法
属性说明
bool
auto_configure_joint = true
If true
, the PhysicalBone2D will automatically configure the first Joint2D
child node. The automatic configuration is limited to setting up the node properties and positioning the Joint2D
.
int
bone2d_index = -1
The index of the Bone2D
that this PhysicalBone2D should simulate.
NodePath
bone2d_nodepath = NodePath("")
The NodePath
to the Bone2D
that this PhysicalBone2D should simulate.
bool
follow_bone_when_simulating = false
If true
, the PhysicalBone2D will keep the transform of the bone it is bound to when simulating physics.
bool
simulate_physics = false
If true
, the PhysicalBone2D will start simulating using physics. If false
, the PhysicalBone2D will follow the transform of the Bone2D
node.
Note: To have the Bone2D
s visually follow the PhysicalBone2D, use a SkeletonModification2DPhysicalBones
modification on the Skeleton2D
node with the Bone2D
nodes.
方法说明
Returns the first Joint2D
child node, if one exists. This is mainly a helper function to make it easier to get the Joint2D
that the PhysicalBone2D is autoconfiguring.
bool
is_simulating_physics ( ) const1
Returns a boolean that indicates whether the PhysicalBone2D is running and simulating using the Godot 2D physics engine. When true
, the PhysicalBone2D node is using physics.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。