SkeletonModification2DPhysicalBones

实验性: Physical bones may be changed in the future to perform the position update of Bone2D on their own, without needing this resource.

继承: SkeletonModification2D < Resource < RefCounted < Object

A modification that applies the transforms of PhysicalBone2D nodes to Bone2D nodes.

描述

This modification takes the transforms of PhysicalBone2D nodes and applies them to Bone2D nodes. This allows the Bone2D nodes to react to physics thanks to the linked PhysicalBone2D nodes.

属性

方法

voidfetch_physical_bones ( )
NodePathget_physical_bone_node ( joint_idx: int ) const1
voidset_physical_bone_node ( joint_idx: int, physicalbone2d_node: NodePath )
voidstart_simulation ( bones: Array StringName = [] )
voidstop_simulation ( bones: Array StringName = [] )

属性说明

int physical_bone_chain_length = 0

  • void set_physical_bone_chain_length ( value: int )
  • int get_physical_bone_chain_length ( )

The number of PhysicalBone2D nodes linked in this modification.


方法说明

void fetch_physical_bones ( )

Empties the list of PhysicalBone2D nodes and populates it with all PhysicalBone2D nodes that are children of the Skeleton2D.


NodePath get_physical_bone_node ( joint_idx: int ) const1

Returns the PhysicalBone2D node at joint_idx.


void set_physical_bone_node ( joint_idx: int, physicalbone2d_node: NodePath )

Sets the PhysicalBone2D node at joint_idx.

Note: This is just the index used for this modification, not the bone index used in the Skeleton2D.


void start_simulation ( bones: Array StringName = [] )

Tell the PhysicalBone2D nodes to start simulating and interacting with the physics world.

Optionally, an array of bone names can be passed to this function, and that will cause only PhysicalBone2D nodes with those names to start simulating.


void stop_simulation ( bones: Array StringName = [] )

Tell the PhysicalBone2D nodes to stop simulating and interacting with the physics world.

Optionally, an array of bone names can be passed to this function, and that will cause only PhysicalBone2D nodes with those names to stop simulating.

2

本方法通常需要用户覆盖才能生效。

1

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。