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.

SkeletonModification2DLookAt

實驗性: This class may be changed or removed in future versions.

繼承: SkeletonModification2D < Resource < RefCounted < Object

Bone2D 節點進行旋轉,讓它看向某個目標的修改器。

說明

這種 SkeletonModification2D 會對骨骼進行旋轉,讓它看向某個目標。適合讓角色的頭部看向玩家、讓炮塔看向目標以及其他需要讓骨骼朝某個東西快速旋轉的情況。

屬性

NodePath

bone2d_node

NodePath("")

int

bone_index

-1

NodePath

target_nodepath

NodePath("")

方法

float

get_additional_rotation() const

bool

get_constraint_angle_invert() const

float

get_constraint_angle_max() const

float

get_constraint_angle_min() const

bool

get_enable_constraint() const

void

set_additional_rotation(rotation: float)

void

set_constraint_angle_invert(invert: bool)

void

set_constraint_angle_max(angle_max: float)

void

set_constraint_angle_min(angle_min: float)

void

set_enable_constraint(enable_constraint: bool)


屬性說明

NodePath bone2d_node = NodePath("") 🔗

要修改的 Bone2D 節點。


int bone_index = -1 🔗

  • void set_bone_index(value: int)

  • int get_bone_index()

要執行修改的 Bone2D 節點的索引。


NodePath target_nodepath = NodePath("") 🔗

作為 LookAt 修改目標的節點的 NodePath。該節點是該修改將 Bone2D 旋轉到的節點。


方法說明

float get_additional_rotation() const 🔗

返回執行 LookAt 修改後被套用的額外旋轉的量。


bool get_constraint_angle_invert() const 🔗

返回該修改的約束是否反轉。


float get_constraint_angle_max() const 🔗

返回該約束允許的最大角度。


float get_constraint_angle_min() const 🔗

返回該約束允許的最小角度。


bool get_enable_constraint() const 🔗

如果該 LookAt 修改器正在使用約束,則返回 true


void set_additional_rotation(rotation: float) 🔗

設定執行該修改後要被套用的額外旋轉的量。這允許將結果偏移輸入的旋轉量。


void set_constraint_angle_invert(invert: bool) 🔗

當為 true 時,修改將使用一個反轉的關節約束。

反轉的關節約束僅將該 Bone2D 約束到輸入的最小角度和最大角度之外的角度。出於這個原因,它被稱為反向關節約束,因為它將關節約束在輸入值的外部。


void set_constraint_angle_max(angle_max: float) 🔗

設定該約束允許的最大角度。


void set_constraint_angle_min(angle_min: float) 🔗

設定該約束允許的最小角度。


void set_enable_constraint(enable_constraint: bool) 🔗

設定此修改器是否使用約束。為 true 時,會在求解 LookAt 修改器時應用約束。