public Bounds CalculateBounds()
        {
            var bounds     = new Bounds();
            var dimensions = OVRPlugin.GetBoundaryDimensions(OVRPlugin.BoundaryType.PlayArea);

            bounds.extents = new Vector3(dimensions.x, dimensions.y, dimensions.z);
            return(bounds);
        }
Esempio n. 2
0
	/// <summary>
	/// Returns a vector that indicates the spatial dimensions of the specified boundary type. (x = width, y = height, z = depth)
	/// </summary>
	public Vector3 GetDimensions(OVRBoundary.BoundaryType boundaryType)
	{
		if (OVRManager.loadedXRDevice == OVRManager.XRDevice.Oculus)
			return OVRPlugin.GetBoundaryDimensions((OVRPlugin.BoundaryType)boundaryType).FromVector3f();

		else
		{
#if !USING_XR_SDK && !REQUIRES_XR_SDK
			Vector3 dimensions;
			if (Boundary.TryGetDimensions(out dimensions, (boundaryType == BoundaryType.PlayArea) ? Boundary.Type.PlayArea : Boundary.Type.TrackedArea))
				return dimensions;
#endif
			return Vector3.zero;
		}
	}
Esempio n. 3
0
    /// <summary>
    /// Returns a vector that indicates the spatial dimensions of the specified boundary type. (x = width, y = height, z = depth)
    /// </summary>
    public Vector3 GetDimensions(OVRBoundary.BoundaryType boundaryType)
    {
        if (OVRManager.loadedXRDevice == OVRManager.XRDevice.Oculus)
        {
            return(OVRPlugin.GetBoundaryDimensions((OVRPlugin.BoundaryType)boundaryType).FromVector3f());
        }

        else
        {
            Vector3 dimensions;
            if (Boundary.TryGetDimensions(out dimensions, (boundaryType == BoundaryType.PlayArea) ? Boundary.Type.PlayArea : Boundary.Type.TrackedArea))
            {
                return(dimensions);
            }
            return(Vector3.zero);
        }
    }
Esempio n. 4
0
    /// <summary>
    /// Returns a vector that indicates the spatial dimensions of the specified boundary type. (x = width, y = height, z = depth)
    /// </summary>
    public Vector3 GetDimensions(OVRBoundary.BoundaryType boundaryType)
    {
        if (OVRManager.loadedXRDevice == OVRManager.XRDevice.Oculus)
        {
            return(OVRPlugin.GetBoundaryDimensions((OVRPlugin.BoundaryType)boundaryType).FromVector3f());
        }

        else
        {
#if UNITY_2017_1_OR_NEWER
            Vector3 dimensions;
            //if (Boundary.TryGetDimensions(out dimensions, (boundaryType == BoundaryType.PlayArea) ? Boundary.Type.PlayArea : Boundary.Type.TrackedArea))
            //return dimensions;
#endif
            return(Vector3.zero);
        }
    }
        void Awake()
        {
#if CVR_STEAMVR || CVR_STEAMVR2
            float roomX = 0;
            float roomY = 0;
            if (Valve.VR.OpenVR.Chaperone == null || !Valve.VR.OpenVR.Chaperone.GetPlayAreaSize(ref roomX, ref roomY))
            {
                gameObject.SetActive(false);
            }
            else if (Mathf.Approximately(roomX, 1f) && Mathf.Approximately(roomY, 1f))
            {
                gameObject.SetActive(false);
            }
#elif CVR_OCULUS
            if (!OVRPlugin.GetBoundaryConfigured() || OVRPlugin.GetBoundaryDimensions(OVRPlugin.BoundaryType.PlayArea).FromVector3f().magnitude < 1)
            {
                gameObject.SetActive(false);
            }
#else
            gameObject.SetActive(false);
#endif
        }
Esempio n. 6
0
 /// <summary>
 /// Returns a vector that indicates the spatial dimensions of the specified boundary type. (x = width, y = height, z = depth)
 /// </summary>
 public Vector3 GetDimensions(OVRBoundary.BoundaryType boundaryType)
 {
     return(OVRPlugin.GetBoundaryDimensions((OVRPlugin.BoundaryType)boundaryType).FromVector3f());
 }