我想使用按钮在我的团结场景中触发动作,但当我按下按钮时,我想不出如何调用相应的方法。我使用VRTK 4 (beta),无法找到任何有用的文档或回答它的问题。
发布于 2020-04-24 15:22:57
VRTK版本4.0 Beta
https://docs.unity3d.com/Manual/xr_input.html
Example Left Oculus Trigger:
Name: VRTK_Axis9_LeftTrigger *[Adapt your name]*
[...] Gravity: 0
Dead: 0.001
Sensitivity: 1
[...]
Type: Joystick Axis
Axis: 9th axis (Joysticks) *[Enter the index number you've looked up before]*
Joy Num: Get Motion from all Joysticks在这里查找属性及其描述:https://docs.unity3d.com/Manual/class-InputManager.html
- If it is an 1DAxis:
- and you want its value (float):
- add the VRTK UnityAxis1DAction script. Set the name from the "Project Settings -> Input" (in the example "VRTK\_Axis9\_LeftTrigger") as axis name.
- and you want its pressed/released (bool):
- add the VRTK UnityAxis1DAction script. Set the name from the "Project Settings -> Input" (in the example "VRTK\_Axis9\_LeftTrigger") as axis name.
- add the Zinnia FloatToBoolean script. In the "Transformed" field, reference the GameObject itself (press + to add). Choose BooleanAction.Receive.
- add the Zinnia BooleanAction script. In the "Activated" field, reference the GameObject that shall react to the button state (press + to add) and choose the method, that shall be called, when the button is pressed. (Repeat for the "Deactivated" field with the method, that shall be called, when the button is released.)
- If it is an 2DAxis:
- and you want its values:
- add the VRTK UnityAxis2DAction script. Set the names from the "Project Settings -> Input" from your x and y axes to the corresponding X axis name and Y axis name.
我希望这能帮助你开始使用新的VRTK版本!
https://stackoverflow.com/questions/61411800
复制相似问题