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...
InputEventAction¶
继承: InputEvent < Resource < RefCounted < Object
动作的输入事件类型。
描述¶
包含一个通用动作,该动作可以被多种类型的输入作为目标。动作及其事件可以在项目 > 项目设置的输入映射选项卡中设置,也可以使用 InputMap 类设置。
注意:与映射到唯一物理事件的其他 InputEvent 子类不同,这个虚拟事件不是由引擎发出的。这个类可以用来使用 Input.parse_input_event 手动发出动作,这样就能够在 Node._input 中接收到这些动作。要检查物理事件是否与“输入映射”中的动作相匹配,请使用 InputEvent.is_action 和 InputEvent.is_action_pressed。
教程¶
属性¶
|
||
|
||
|
属性说明¶
StringName action = &""
void set_action ( StringName value )
StringName get_action ( )
动作的名称。动作可以通过此 String 访问。
bool pressed = false
为 true
时该动作处于被按下的状态。为 false
时该动作处于被释放状态。
float strength = 1.0
动作的强度,介于 0 和 1 之间。当 pressed 为 false
时,该值被视为等于 0。通过将事件强度设置为手柄轴的弯曲或按压强度,可以仿造模拟手柄的移动事件。