HTC Vive development: About handle keys

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.