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...
SkeletonModification2D
实验性: This class may be changed or removed in future versions.
继承: Resource < RefCounted < Object
派生: SkeletonModification2DCCDIK, SkeletonModification2DFABRIK, SkeletonModification2DJiggle, SkeletonModification2DLookAt, SkeletonModification2DPhysicalBones, SkeletonModification2DStackHolder, SkeletonModification2DTwoBoneIK
对 Skeleton2D 中的 Bone2D 进行操作的资源的基类。
描述
该资源提供了一个可以扩展的接口,因此在 Skeleton2D 中的 Bone2D 节点上运行的代码可以被混合并匹配在一起,以创建复杂的交互。
这用于为 Godot 提供一套灵活而强大的反向运动学解决方案,该解决方案可以适用许多不同的用途。
属性
|
||
|
方法
void |
_draw_editor_gizmo() virtual |
void |
|
void |
_setup_modification(modification_stack: SkeletonModificationStack2D) virtual |
clamp_angle(angle: float, min: float, max: float, invert: bool) |
|
get_editor_draw_gizmo() const |
|
get_is_setup() const |
|
void |
set_editor_draw_gizmo(draw_gizmo: bool) |
void |
set_is_setup(is_setup: bool) |
属性说明
如果为 true
,则该修改器的 _execute() 函数将被该 SkeletonModificationStack2D 调用。
修改器的执行模式。会告诉修改器栈何时执行该修改器。某修修改器存在只能在特定执行模式下可用的设置。
方法说明
void _draw_editor_gizmo() virtual 🔗
用于绘制编辑器专用的修改器小工具。此函数只会在 Godot 编辑器中调用,并且可以被覆盖,来绘制自定义小工具。
注意:你需要使用来自 SkeletonModificationStack2D.get_skeleton() 的 Skeleton2D 及其绘制函数,因为 SkeletonModification2D 资源本身无法进行绘制。
void _execute(delta: float) virtual 🔗
执行给定的修改器。修改器在此时执行应执行的函数。
void _setup_modification(modification_stack: SkeletonModificationStack2D) virtual 🔗
安装修改器时调用。修改器在此时执行初始化。
float clamp_angle(angle: float, min: float, max: float, invert: bool) 🔗
接受角度并将其钳制在传入的 min
和 max
范围内。invert
会逆向钳制该角度,将其钳制在给定范围之外。
bool get_editor_draw_gizmo() const 🔗
返回这个修改器是否会在 Godot 编辑器中调用 _draw_editor_gizmo() 绘制针对修改器的小工具。
返回此修改器是否已被成功安装。
SkeletonModificationStack2D get_modification_stack() 🔗
返回该修改器绑定的 SkeletonModificationStack2D。你可以通过这个修改器栈来访问修改器所操作的 Skeleton2D。
void set_editor_draw_gizmo(draw_gizmo: bool) 🔗
设置这个修改器是否会在 Godot 编辑器中调用 _draw_editor_gizmo() 绘制针对修改器的小工具。
void set_is_setup(is_setup: bool) 🔗
允许你手动设置该修改器的安装状态。这个函数应很少使用,因为该修改器所绑定的 SkeletonModificationStack2D 应该对该修改器进行安装。