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.

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 提供一套靈活而強大的反向運動學解決方案,該解決方案可以適用許多不同的用途。

屬性

bool

enabled

true

int

execution_mode

0

方法

void

_draw_editor_gizmo() virtual

void

_execute(delta: float) virtual

void

_setup_modification(modification_stack: SkeletonModificationStack2D) virtual

float

clamp_angle(angle: float, min: float, max: float, invert: bool)

bool

get_editor_draw_gizmo() const

bool

get_is_setup() const

SkeletonModificationStack2D

get_modification_stack()

void

set_editor_draw_gizmo(draw_gizmo: bool)

void

set_is_setup(is_setup: bool)


屬性說明

bool enabled = true 🔗

  • void set_enabled(value: bool)

  • bool get_enabled()

如果為 true,則該修改器的 _execute() 函式將被該 SkeletonModificationStack2D 呼叫。


int execution_mode = 0 🔗

  • void set_execution_mode(value: int)

  • int get_execution_mode()

修改器的執行模式。會告訴修改器堆疊何時執行該修改器。某修修改器存在只能在特定執行模式下可用的設定。


方法說明

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) 🔗

接受角度並將其鉗制在傳入的 minmax 範圍內。invert 會逆向鉗制該角度,將其鉗制在給定範圍之外。


bool get_editor_draw_gizmo() const 🔗

返回這個修改器是否會在 Godot 編輯器中呼叫 _draw_editor_gizmo() 繪製針對修改器的小工具。


bool get_is_setup() const 🔗

返回此修改器是否已被成功安裝。


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 應該對該修改器進行安裝。