Search Unity

Question Set a default positions to XR Device Simulator

Discussion in 'XR Interaction Toolkit and Input' started by kexar66, Feb 16, 2021.

  1. kexar66

    kexar66

    Joined:
    Feb 27, 2013
    Posts:
    48
    Hi guys,
    is there a way how to set a default positions to camera, left hand, right hand in XR Device Simulator? Right now it is always reset to zero position after start.

    Thanks!
     
  2. chris-massie

    chris-massie

    Unity Technologies

    Joined:
    Jun 23, 2020
    Posts:
    231
    At the moment, there is no way to configure this. We are planning on improving the API to allow the simulator to be more fully customized including giving a set of sensible default poses for the HMD and controllers, but no timeline for when this will be done at the moment.
     
  3. geo_p

    geo_p

    Joined:
    Jul 24, 2012
    Posts:
    5
    Hello there, is there any update on this?

    Just wondering if I can save my default HMD and controller positions so I don't have to spend precious seconds positioning them every time I hit play. Thanks!
     
  4. geo_p

    geo_p

    Joined:
    Jul 24, 2012
    Posts:
    5
    If anyone is interested, I wrote a helper script you can add to the XR Device Simulator prefab to save the position and rotation state of the HMD + controllers in PlayerPrefs between play sessions.

    Tested with XRInteractionToolkit 2.0.3, may break in future versions as it access private member variables.
     

    Attached Files:

    tom_e_roberts likes this.
  5. Deleted User

    Deleted User

    Guest

    Thank you. I also found out you have to restart the editor after adding XRDeviceSimulatorPersist otherwise it doesn't work.
     
  6. georgia_gla

    georgia_gla

    Joined:
    Jan 21, 2023
    Posts:
    1
    I'm new to Unity so can you please explain how we should go about adding this script?
     
  7. Deleted User

    Deleted User

    Guest

    Drag it on top of a GameObject in the scene or click AddComponent in the GameObject and select XRDeviceSimulatorPersist. Goes without saying that first you have to drag it in the Assets folder as a XRDeviceSimulatorPersist.cs file.
     
  8. matheus_inmotionvr

    matheus_inmotionvr

    Joined:
    Oct 3, 2018
    Posts:
    63
    It's been three years, and here we are. The fact that this wasn't simply a serialized field on the component to begin with baffles me. The default values are great too: here are controllers right on your face, regardless of whether you want to use them.