using System.Collections; using System.Collections.Generic; using UnityEngine; using static OVRBoundary; public class GuardianScript : MonoBehaviour { private Vector3[] boundaryPoints; private bool createdWall = false; private int boardDistance = 8; public GameObject wallBoard; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { if (!createdWall) { CreateWall(); } } private void CreateWall() { bool configured = OVRManager.boundary.GetConfigured(); if (configured) { boundaryPoints = OVRManager.boundary.GetGeometry(OVRBoundary.BoundaryType.OuterBoundary); for (int i = 0; i < boundaryPoints.Length; i++) { if (i % boardDistance == 0) { var newBoard = Instantiate(wallBoard, boundaryPoints[i], Quaternion.identity); Vector3 forward = Vector3.zero; if (i < boundaryPoints.Length - 1) { forward = boundaryPoints[i] - boundaryPoints[i + 1]; } newBoard.transform.forward = forward; } } createdWall = true; } } }