Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How do I scale the XR Rig/Player viewport

Discussion in 'XR Interaction Toolkit and Input' started by kahunamoore, May 15, 2021.

  1. kahunamoore

    kahunamoore

    Joined:
    Nov 30, 2014
    Posts:
    3
    I'd like to implement a feature similar to what the Holoception (Demo) app does with it's player/view scaling. I've tried several approaches I found on the interwebs including creating an empty parent object and scaling that but no joy. Also tried changing the Camera's Viewport Rect w/h but that distorts the world very strangely.

    Another example is the Demeo game which does a similar scaling of the player. I'm less concerned with the player's avatar model itself (I'm sure I'll have to do that at some point) but more with the viewport the camera sees.

    Any suggestions on what else I could try?

    Thanks!
     
  2. Sab_Rango

    Sab_Rango

    Joined:
    Aug 30, 2019
    Posts:
    121
    I think the whole scene scale is changing when the XR rig gets closer to the player.
     
    kahunamoore likes this.
  3. LifehackersTW

    LifehackersTW

    Joined:
    Sep 25, 2021
    Posts:
    1
    Check this solution out. I've been looking for the same thing too, and I found this demo and it totally works for me.
    It's the total solution for the grip world movement, and the whole world needs to be put in a empty parent object like you've tried.

    https://www.reddit.com/r/Unity3D/comments/a6rmbh/vr_question_steamvr_2_scale_object_with_both_hands/
    https://github.com/n1ckfg/WorldScale

    I made some changes to it, and you don't even need the steam vr package.
    https://gist.github.com/landicefu/efdb723441c2b69c4507a8ff7117c305
    You should change following lines based on how you detect the grip on your controllers.
    bool leftGrip = Input.GetAxis("Left Grip") > GRIP_THRESHOLD;
    bool rightGrip = Input.GetAxis("Right Grip") > GRIP_THRESHOLD;
     
  4. TymNetwork

    TymNetwork

    Joined:
    Jan 16, 2014
    Posts:
    84
    Does...
    bool leftGrip = Input.GetAxis("Left Grip") > GRIP_THRESHOLD;
    bool rightGrip = Input.GetAxis("Right Grip") > GRIP_THRESHOLD;

    Does it change the input for OVR or XR - I am still new at this VR implementation from
    Fps to VR