Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
matrix211v1's avatar
matrix211v1
Honored Guest
6 years ago

Scaling OVRCameraRig

Hello All!
I have been looking through the forum and I have found some of my answers, but no one has posted the actual solution.
I would like to scale the OVRCameraRig. I have a full size room, like a living room, and everything looks fine. However, I want to shrink this room down to something small ( or scale up the player ) so the room would look like a doll house.
I know I can scale down the entire environment, but this causes a lot of shaders to freak out so I want to avoid that.
In other VR packages, you would just create a Empty GameObject and put the CameraRig as a child and scale the parent. That doesn't seem to work for Oculus.
Any suggestions?
Thanks!

6 Replies

Replies have been turned off for this discussion
  • @matrix211v1 Man you're not going to believe it but I just found the solution : you need to scale OVRCameraRig AFTER entering Play mode, for example in the OnEnable function. That's it.
  • That is quite interesting. I believe I have tried it to scale it after hitting play and modifying it in the editor. Are you *sure* that your scaling the "OVRPlayerController" or a Parent GameObject of it? To me it is changing but it's just making the camera further away from the main of it's origin which gives the impression that it's smaller. 

    I could be and have known to be wrong.
  • I am scaling the OVRCameraRig prefab instance itself. I does scale the world, not only distances. 100% sure :)
  • Scaling the OVRCameraRig prefab worked for me too.  Here's a script I used to test it out:

    using UnityEngine;
    
    public class ScalePlayer : MonoBehaviour
    {
        public GameObject cameraRig;
        public Vector3 defaultScale = new Vector3(1f, 1f, 1f);
        public Vector3 alternateScale = new Vector3(20f, 20f, 20f);
    
        bool scaled = false;
    
        void Update()
        {
            if (Input.GetButtonDown("Oculus_CrossPlatform_PrimaryIndexTrigger"))
            {
                ToggleScale();
            }
        }
    
        void ToggleScale()
        {
            if (scaled)
            {
                cameraRig.transform.localScale = defaultScale;
            } else
            {
                cameraRig.transform.localScale = alternateScale;
            }
            scaled = !scaled;
        }
    }