/// <summary> /// Removes from local camera set list. /// </summary> /// <param name="obj">Object.</param> public static void RemoveFromLocalCameraSetList(ref OVRCameraGameObject obj) { CameraLocalSetList.Remove(obj); }
/// <summary> /// Adds to local camera set list. /// </summary> /// <param name="obj">Object.</param> public static void AddToLocalCameraSetList(ref OVRCameraGameObject obj) { CameraLocalSetList.Add(obj); }
/// <summary> /// Removes from local camera set list. /// </summary> /// <param name="obj">Object.</param> static public void RemoveFromLocalCameraSetList(ref OVRCameraGameObject obj) { CameraLocalSetList.Remove(obj); }
/// <summary> /// Adds to local camera set list. /// </summary> /// <param name="obj">Object.</param> static public void AddToLocalCameraSetList(ref OVRCameraGameObject obj) { CameraLocalSetList.Add(obj); }
/// <summary> /// Creates the cube grid. /// </summary> void CreateCubeGrid() { Debug.LogWarning("Create CubeGrid"); // Create the visual cube grid CubeGrid = new GameObject("CubeGrid"); // Set a layer to target a specific camera CubeGrid.layer = CameraController.gameObject.layer; // Create a CameraGameObject to update within Camera CameraCubeGrid = new OVRCameraGameObject(); // Set CubeGrid GameObject and CameraController // to allow for targeting depth within OVRCamera update CameraCubeGrid.CameraGameObject = CubeGrid; CameraCubeGrid.CameraController = CameraController; for (int x = -gridSizeX; x <= gridSizeX; x++) for (int y = -gridSizeY; y <= gridSizeY; y++) for (int z = -gridSizeZ; z <= gridSizeZ; z++) { // Set the cube type: // 0 = non-axis cube // 1 = axis cube // 2 = center cube int CubeType = 0; if ((x == 0 && y == 0) || (x == 0 && z == 0) || (y == 0 && z == 0)) { if((x == 0) && (y == 0) && (z == 0)) CubeType = 2; else CubeType = 1; } GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube); BoxCollider bc = cube.GetComponent<BoxCollider>(); bc.enabled = false; cube.layer = CameraController.gameObject.layer; // No shadows cube.GetComponent<Renderer>().castShadows = false; cube.GetComponent<Renderer>().receiveShadows = false; // Cube line is white down the middle if (CubeType == 0) cube.GetComponent<Renderer>().material.color = Color.red; else if (CubeType == 1) cube.GetComponent<Renderer>().material.color = Color.white; else cube.GetComponent<Renderer>().material.color = Color.yellow; cube.transform.position = new Vector3(((float)x * gridScale), ((float)y * gridScale), ((float)z * gridScale)); float s = 0.7f; // Axis cubes are bigger if(CubeType == 1) s = 1.0f; // Center cube is the largest if(CubeType == 2) s = 2.0f; cube.transform.localScale = new Vector3(cubeScale * s, cubeScale * s, cubeScale * s); cube.transform.parent = CubeGrid.transform; } }
/// <summary> /// Creates the cube grid. /// </summary> void CreateCubeGrid() { Debug.LogWarning("Create CubeGrid"); // Create the visual cube grid CubeGrid = new GameObject("CubeGrid"); // Set a layer to target a specific camera CubeGrid.layer = CameraController.gameObject.layer; // Create a CameraGameObject to update within Camera CameraCubeGrid = new OVRCameraGameObject(); // Set CubeGrid GameObject and CameraController // to allow for targeting depth within OVRCamera update CameraCubeGrid.CameraGameObject = CubeGrid; CameraCubeGrid.CameraController = CameraController; for (int x = -gridSizeX; x <= gridSizeX; x++) { for (int y = -gridSizeY; y <= gridSizeY; y++) { for (int z = -gridSizeZ; z <= gridSizeZ; z++) { // Set the cube type: // 0 = non-axis cube // 1 = axis cube // 2 = center cube int CubeType = 0; if ((x == 0 && y == 0) || (x == 0 && z == 0) || (y == 0 && z == 0)) { if ((x == 0) && (y == 0) && (z == 0)) { CubeType = 2; } else { CubeType = 1; } } GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube); BoxCollider bc = cube.GetComponent <BoxCollider>(); bc.enabled = false; cube.layer = CameraController.gameObject.layer; // No shadows cube.renderer.castShadows = false; cube.renderer.receiveShadows = false; // Cube line is white down the middle if (CubeType == 0) { cube.renderer.material.color = Color.red; } else if (CubeType == 1) { cube.renderer.material.color = Color.white; } else { cube.renderer.material.color = Color.yellow; } cube.transform.position = new Vector3(((float)x * gridScale), ((float)y * gridScale), ((float)z * gridScale)); float s = 0.7f; // Axis cubes are bigger if (CubeType == 1) { s = 1.0f; } // Center cube is the largest if (CubeType == 2) { s = 2.0f; } cube.transform.localScale = new Vector3(cubeScale * s, cubeScale * s, cubeScale * s); cube.transform.parent = CubeGrid.transform; } } } }