vrtk_ControllerEvent是vrtk中处理控制器相关消息的脚本。
其中所包括的事件如下,在此脚本中定义了枚举ButtonAlias
public enum ButtonAlias -
Button types
-
Undefined- 没有指定的按钮 -
TriggerHairline- 当触发器扳过最小的阈值。 -
TriggerTouch- 当触发器被少量半. -
TriggerPress- 当触发器被扮了一半. -
TriggerClick- 触发器完全被扮过来. -
GripHairline- 当grip按钮被按下一点点. -
GripTouch- The grip 按钮被接触到. -
GripPress- The grip 按钮被按下. -
GripClick- The grip button 完全按下. -
TouchpadTouch- 触摸板被触摸(没有被按下). -
TouchpadPress- 触摸板被按下to the point of hearing a click). -
ButtonOneTouch- The button one is touched. -
ButtonOnePress- The button one is pressed. -
ButtonTwoTouch- The button one is touched. -
ButtonTwoPress- The button one is pressed. -
StartMenuPress- The button one is pressed.
要使用这个脚本来响应控制器的时间还需要在添加此脚本的游戏对象上添加一个监听脚本。
添加了controllerEvent脚本后,可以看到insepctor面板上的这些参数。
- Axis Fidelity:按键按下的程度,完全按下是1,松开是0.目前 T任何大于二的结果会给出过于敏感的结果he amount of fidelity in the changes on the axis, which is defaulted to 1. Any number higher than 2 will probably give too sensitive results.
- Trigger Click Threshold:扳机触发的最小值。 The level on the trigger axis to reach before a click is registered.
- Trigger Force Zero Threshold:班级停止处罚的最小值 The level on the trigger axis to reach before the axis is forced to 0f.
- Trigger Axis Zero On Untouch: If this is checked then the trigger axis will be forced to 0f when the trigger button reports an untouch event.
- Grip Click Threshold: grip按钮点击的阈值The level on the grip axis to reach before a click is registered.
- Grip Force Zero Threshold:按钮停止出发的阈值 The level on the grip axis to reach before the axis is forced to 0f.
- Grip Axis Zero On Untouch: If this is checked then the grip axis will be forced to 0f when the grip button reports an untouch event.
添加VRTK_ControllerEvent_UnityEvents组件到VRTK_ControllerEvent物体上可以对unityevent进行访问。
所有的委托事件被映射到unityEvent中加前缀On的。