One, about the corresponding relationship between the left and right handles
- Two handles and steamvr_trackedobject.eindex are corresponding, one is Eindex.device2, the other is Eindex.device3 (the numbered one)
- in the scene, the handle is connected successively, the controller (right), the controller (left) are activated, and the Steamvr_trackedobject component is added .
Second, handle button
1-Menu key
6-System Key (press the rear handle to disconnect, press the handle again to connect again)
7-Trigger Key
8-Holding key
9-Touch Pad key
(1) Tap
Key monitoring mode one: (STEAMVR way, encapsulated OPENVR)
get key events via Device.getpressdown/getpressup/getpress
Key listening mode two: (OPENVR way, partial bottom)
Controllerstate.ulbuttonpressed & (SteamVR_Controller.ButtonMask.Trigger) for Key Press, release two states
Or:
Note: m_state, m_prevstate, respectively: Current frame state, previous frame state
Gets the value of the touchpad when pressed
Gets the value of the touchpad when released (must use the state of the previous frame, because the current frame's touch value is 0 when released)
problem: When pressed,
No value is obtained to the
current frame touchpad!
reason for guessing: The Update method that gets the value is executed before updating the state Update method, so the value of the touchpad cannot be obtained until the updated state's Update method executes .
Workaround: If you do not want to modify the script execution order, you can use the Lateupdate
(2) Touch
- For touch pad keys
- For the trigger (and tap similar, just a shorter key)
Way One:
Way two:
problem: When touch is pressed, no value is obtained to the current frame touchpad!
Reason: Unclear, internal mechanisms need to be clear
Workaround: Get the value of the touchpad after touching the second frame.
(3) access to the touch plate shaft
Get the vrcontrollerstate_t in the two ways, get the axis of the touchpad
x = state.raxis0.x
y = state.raxis0.y
HTC Vive development: About handle keys