Search Unity

  1. Get top assets for 50% off! Black Friday Sale 2021.
    Dismiss Notice
  2. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

[HTC Vive] Rotating play area during runtime throws off controller's device.velocity

Discussion in 'AR/VR (XR) Discussion' started by Zdejah, May 31, 2017.

  1. Zdejah

    Zdejah

    Joined:
    Feb 7, 2017
    Posts:
    2
    Hey All,
    Im getting a strange issue when trying to rotate the Vive Play Area during runtime. Ive made a teleporter script which allows the user to choose the direction they will be facing when the teleport is complete. I do this by translating the play area (offset by the vector between the play area's center and the user's head position on the ground) and then rotating the entire play area around the user's head position in the global Y axis. This seems to work fine until I try to throw an object using SteamVRController.Device device.velocity. It seems that the returned velocity is relative to the play area's original orientation, and thus throwing things becomes really wacky. Any one else encounter this before? Using Unity 5.3.3 and I dont have the option to update :(
    Thanks!
     
  2. Lasse-Loepfe

    Lasse-Loepfe

    Joined:
    Mar 28, 2014
    Posts:
    25
    Hi,

    yes, the velocity given by the device is relative to the player area. You have to transform it into world coordinates:

    velocity = PlayerArea.rotation * velocity;

    where PlayerArea is the transform that has the SteamVR_PlayArea component.
     
unityunity