Provides access to the Oculus boundary system.
Пример #1
0
        /// <summary>
        /// The GetPlayAreaVertices method returns the points of the play area boundaries.
        /// </summary>
        /// <param name="playArea">The GameObject containing the play area representation.</param>
        /// <returns>A Vector3 array of the points in the scene that represent the play area boundaries.</returns>
        public override Vector3[] GetPlayAreaVertices(GameObject playArea)
        {
            var area = new OVRBoundary();

            if (area.GetConfigured())
            {
                var outerBoundary = area.GetDimensions(OVRBoundary.BoundaryType.OuterBoundary);
                var thickness     = 0.1f;

                var vertices = new Vector3[8];

                vertices[0] = new Vector3(outerBoundary.x - thickness, 0f, outerBoundary.z - thickness);
                vertices[1] = new Vector3(0f + thickness, 0f, outerBoundary.z - thickness);
                vertices[2] = new Vector3(0f + thickness, 0f, 0f + thickness);
                vertices[3] = new Vector3(outerBoundary.x - thickness, 0f, 0f + thickness);

                vertices[4] = new Vector3(outerBoundary.x, 0f, outerBoundary.z);
                vertices[5] = new Vector3(0f, 0f, outerBoundary.z);
                vertices[6] = new Vector3(0f, 0f, 0f);
                vertices[7] = new Vector3(outerBoundary.x, 0f, 0f);

                return(vertices);
            }
            return(new Vector3[0]);
        }
Пример #2
0
    // Start is called before the first frame update
    void Start()
    {
        this.oVRBoundary = new OVRBoundary();
        // OVRBoundary. = new OVRBoundary.BoundaryLookAndFeel();
        //lookAndFeel.Color = this.boundaryColor;

        //this.oVRBoundary.SetLookAndFeel(lookAndFeel);

        //int index = 0;

        /*float minX = 1000;
         * float maxX = -1000;
         * float minZ = 1000;
         * float maxZ = -1000;
         * foreach (Vector3 v in this.oVRBoundary.GetGeometry(OVRBoundary.BoundaryType.OuterBoundary)) {
         *  if (v.x < minX) minX = v.x;
         *  if (v.x > maxX) maxX = v.x;
         *  if (v.z < minZ) minZ = v.z;
         *  if (v.z > maxZ) maxZ = v.z;
         * }
         *
         * this.boundaryMinLimit = new Vector3(minX, 0, minZ);
         * this.boundaryMaxLimit = new Vector3(maxX, 0, maxZ);
         *
         * Debug.Log("Outer Boundary Min" + this.boundaryMinLimit );
         * Debug.Log("Outer Boundary Max" + this.boundaryMaxLimit);
         */
    }
Пример #3
0
    // Start is called before the first frame update
    void Awake()
    {
        meshFilter = GetComponent <MeshFilter>();
        boundary   = OVRManager.boundary;

        prefabBoundaryPoints = new List <Transform>();
    }
Пример #4
0
	void Initialize()
	{
		if (display == null)
			display = new OVRDisplay():
		if (tracker == null)
			tracker = new OVRTracker():
		if (boundary == null)
			boundary = new OVRBoundary():

		reorientHMDOnControllerRecenter = _reorientHMDOnControllerRecenter:
	}
Пример #5
0
 void Initialize()
 {
     if (display == null)
     {
         display = new OVRDisplay();
     }
     if (tracker == null)
     {
         tracker = new OVRTracker();
     }
     if (boundary == null)
     {
         boundary = new OVRBoundary();
     }
 }
Пример #6
0
    void Initialize()
    {
        if (display == null)
        {
            display = new OVRDisplay();
        }
        if (tracker == null)
        {
            tracker = new OVRTracker();
        }
        if (boundary == null)
        {
            boundary = new OVRBoundary();
        }

        reorientHMDOnControllerRecenter = _reorientHMDOnControllerRecenter;
    }
Пример #7
0
    void Start()
    {
        Debug.Log("Navigator started!");
        stepGameTimer    = 0f;
        PlayerCamera     = GameObject.FindGameObjectWithTag("casa").GetComponent <OVRCameraRig>();
        PlayerController = GameObject.FindGameObjectWithTag("PlayerController").GetComponent <OVRPlayerController>();
        // RedLight = GameObject.FindGameObjectWithTag("RedLight").GetComponent<Light>();
        lineRenderer = GetComponent <LineRenderer>();
        Heartbeat    = PlayerController.GetComponents <AudioSource>()[0];
        Breath       = PlayerController.GetComponents <AudioSource>()[1];
        EvilEye      = GameObject.FindGameObjectWithTag("Eye");
        EyeLight     = GameObject.FindGameObjectWithTag("EyeLight").GetComponent <Light>();
        LightUpEye   = GameObject.FindGameObjectWithTag("LightUpEye").GetComponent <Light>();

        // Getting audio sources
        BenignTutorial       = GetComponents <AudioSource>()[9];
        BenignWakeUpVictory  = GetComponents <AudioSource>()[8];
        BenignOneLastStep    = GetComponents <AudioSource>()[7];
        BenignSmashLight     = GetComponents <AudioSource>()[6];
        BadSpiritYouDead     = GetComponents <AudioSource>()[5];
        BenignStandUpAudio   = GetComponents <AudioSource>()[4];
        BenignStayDownAudio  = GetComponents <AudioSource>()[3];
        BenignGoingDownAudio = GetComponents <AudioSource>()[2];
        BenignStayStillAudio = GetComponents <AudioSource>()[1];
        SmashLightSound      = GetComponents <AudioSource>()[0];

        // Set initial variables
        initialHeartbeatPitch = Heartbeat.pitch;
        // initialLightIntensity = RedLight.intensity;
        // initialPlayerPosition = PlayerCamera.centerEyeAnchor.position;
        initialPlayerPosition      = StaticValue.initialPlayerPosition;
        initialPlayerLocalPosition = PlayerCamera.centerEyeAnchor.localPosition;
        boundary = OVRManager.boundary;
        guardianBoundariesPoint = new List <GameObject>();
        playAreaBoundariesPoint = new List <GameObject>();
        random = new System.Random();

        // getGuardianCenter();

        // BenignTutorial.Play(0);
    }
Пример #8
0
    // Start is called before the first frame update
    void Start()
    {
        // Detect all the boundaries
        rawBoundary    = OVRManager.boundary;
        boundaryPoints = rawBoundary.GetGeometry(OVRBoundary.BoundaryType.PlayArea);
        boundarySize   = rawBoundary.GetDimensions(OVRBoundary.BoundaryType.PlayArea);
        // shrink the boundary to sth like 3m * 3m space

        // get camera postion and directions
        OVRCameraRig rig = cameraObject.GetComponent <OVRCameraRig>();

        cameraPostion   = rig.trackingSpace.position;
        cameraDirection = rig.trackingSpace.rotation * new Vector3(1.0f, 1.0f, 1.0f);

        // Make the world disappear until the user walks to the way pointer
        SetObjInvisible(world, false);

        // Get RDWTest component
        rdw = cameraObject.GetComponent <RDW>();

        initWayPointers = new List <GameObject>();
        FetchInitWayPointers();
    }
Пример #9
0
    private void Awake()
    {
        // Only allow one instance at runtime.
        if (instance != null)
        {
            enabled = false;
            DestroyImmediate(this);
            return;
        }

        instance = this;

        Debug.Log("Unity v" + Application.unityVersion + ", " +
                  "Oculus Utilities v" + OVRPlugin.wrapperVersion + ", " +
                  "OVRPlugin v" + OVRPlugin.version + ", " +
                  "SDK v" + OVRPlugin.nativeSDKVersion + ".");

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
        if (SystemInfo.graphicsDeviceType != UnityEngine.Rendering.GraphicsDeviceType.Direct3D11)
        {
            Debug.LogWarning("VR rendering requires Direct3D11. Your graphics device: " + SystemInfo.graphicsDeviceType);
        }
#endif

        // Detect whether this platform is a supported platform
        RuntimePlatform currPlatform = Application.platform;
        isSupportedPlatform |= currPlatform == RuntimePlatform.Android;
        //isSupportedPlatform |= currPlatform == RuntimePlatform.LinuxPlayer;
        isSupportedPlatform |= currPlatform == RuntimePlatform.OSXEditor;
        isSupportedPlatform |= currPlatform == RuntimePlatform.OSXPlayer;
        isSupportedPlatform |= currPlatform == RuntimePlatform.WindowsEditor;
        isSupportedPlatform |= currPlatform == RuntimePlatform.WindowsPlayer;
        if (!isSupportedPlatform)
        {
            Debug.LogWarning("This platform is unsupported");
            return;
        }

#if UNITY_ANDROID && !UNITY_EDITOR
        // We want to set up our touchpad messaging system
        OVRTouchpad.Create();

        // Turn off chromatic aberration by default to save texture bandwidth.
        chromatic = false;
#endif

        if (display == null)
        {
            display = new OVRDisplay();
        }
        if (tracker == null)
        {
            tracker = new OVRTracker();
        }
        if (boundary == null)
        {
            boundary = new OVRBoundary();
        }

        if (resetTrackerOnLoad)
        {
            display.RecenterPose();
        }

        // Disable the occlusion mesh by default until open issues with the preview window are resolved.
        OVRPlugin.occlusionMesh = false;

        OVRPlugin.ignoreVrFocus = runInBackground;
    }