Search Unity

SteamVR plugin - what is responsible for moving the camera in response to HMD movement?

Discussion in 'AR/VR (XR) Discussion' started by DWarwick, Feb 12, 2017.

  1. DWarwick

    DWarwick

    Joined:
    Jan 21, 2017
    Posts:
    4
    I'm using the SteamVR plugin, and I've been looking through its scripts trying to find what actually moves the in-game camera when the HMD moves. As in, if this script was disabled, the camera in-game wouldn't move at all when I moved the HMD. I haven't been able to find a script that does this in the Assets>SteamVR>Scripts folder. Where is the script responsible for this, and what is it named?
     
  2. joshenes

    joshenes

    Joined:
    Apr 18, 2014
    Posts:
    48
    Since Unity 5.4, movement of the camera is done natively by Unity itself, not the SteamVR asset.
     
  3. DWarwick

    DWarwick

    Joined:
    Jan 21, 2017
    Posts:
    4
    Thanks! Is there any way to configure unity's camera movement?
     
  4. joshenes

    joshenes

    Joined:
    Apr 18, 2014
    Posts:
    48
    The actual camera node itself, I don't think so. But you can parent the camera under another transform and move that.
     
    DWarwick likes this.
  5. DWarwick

    DWarwick

    Joined:
    Jan 21, 2017
    Posts:
    4
    Hey, I tried parenting the camera to a cube, but was still able to look around inside the HMD. Any other ideas?
     
  6. joshenes

    joshenes

    Joined:
    Apr 18, 2014
    Posts:
    48
    Correct. This just allows you to offset the camera, for example if you wanted to put the person in a moving car.
    As far as I know there is no option to control the local transform of the camera and I don't think there should be one. It sounds like you want to either disable the tracking of the headset or manually control the camera, but this would create a very unpleasant experience for the user.
     
  7. DWarwick

    DWarwick

    Joined:
    Jan 21, 2017
    Posts:
    4
    This is for research purposes -- not an actual game -- so that is exactly the kind of stuff I want to break and tweak.
     
  8. joshenes

    joshenes

    Joined:
    Apr 18, 2014
    Posts:
    48
    You would have to look through the SteamVR SDK to see if there is some sort of command to disable it. For example I know in the Oculus SDK you can turn off positional tracking, but I've never seen anything to disable rotation.
     
  9. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Take a look at XRDevice.DisableAutoXRCameraTracking(_camera, true);

    This stops the camera moving and rotating, letting you set the locations manually.
     
  10. unity_yVLiKCix-iITug

    unity_yVLiKCix-iITug

    Joined:
    Aug 22, 2019
    Posts:
    2
    Did you ever find a way to do this?