GetDimensions() public method

Returns a vector that indicates the spatial dimensions of the specified boundary type. (x = width, y = height, z = depth)
public GetDimensions ( OVRBoundary.BoundaryType boundaryType ) : Vector3,
boundaryType OVRBoundary.BoundaryType
return Vector3,
        /// <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]);
        }
Example #2
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();
    }