GetGeometry() public méthode

Returns an array of 3d points (in clockwise order) that define the specified boundary type. All points are returned in local tracking space shared by tracked nodes and accessible through OVRCameraRig's trackingSpace anchor.
public GetGeometry ( OVRBoundary.BoundaryType boundaryType ) : Vector3[],
boundaryType OVRBoundary.BoundaryType
Résultat Vector3[],
Exemple #1
0
    /*
     * Create the next target that the user is supposed to reach.
     * We want to pick a random point on the Guardian's boundaries.
     */
    private void createNextTarget(Vector3 playerPosition)
    {
        // Let's pick all the points beloning to the current guardian's boundaries.
        Vector3[] guardianBoundaries = boundary.GetGeometry(OVRBoundary.BoundaryType.OuterBoundary);

        // Let's pick one of those points and rebase it according to player position.
        Vector3 targetPosition = guardianBoundaries[random.Next(guardianBoundaries.Length)] + initialPlayerPosition;

        // Let's scale the position a bit to make sure it is inside the play area.
        var finalPosition = movePointTowardsPlayer(targetPosition);

        // Finally create the Target!
        CurrentTarget = Instantiate(TargetPrefab, finalPosition, transform.rotation);

        // Update the min distance of the player to the target, this is used to scale the
        // heartbeat.
        targetMinDistance = getDistanceFromTarget(playerPosition, CurrentTarget.transform.position);
    }
Exemple #2
0
    void GetGuardianBoundary(OVRBoundary.BoundaryType boundaryType)
    {
        ClearBoundaryPrefabList();

        List <Vector3> boundaryTemp = new List <Vector3>();
        List <Vector3> heightVerts  = new List <Vector3>();

        boundaryTemp.AddRange(boundary.GetGeometry(boundaryType));

        for (int i = 0; i < boundaryTemp.Count; i++)
        {
            Vector3 temp = boundaryTemp[i];
            temp.y += maxBoundaryHeight;
            heightVerts.Add(temp);
        }

        boundaryTemp.AddRange(heightVerts);

        boundaryVertices = boundaryTemp.ToArray();

        xSize = boundaryVertices.Length;
    }
Exemple #3
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();
    }