private void UpdateStereoCamCullingMask() { ViveSR_DualCameraRig prefabRig = PrefabUtility.GetCorrespondingObjectFromSource(ViveSR_DualCameraRig.Instance) as ViveSR_DualCameraRig; prefabRig.VirtualCamera.cullingMask = -1; int LeftEyeLayer = LayerMask.NameToLayer(LefteyeLayerName); int RightEyeLayer = LayerMask.NameToLayer(RighteyeLayerName); int PortalWorldLayer = LayerMask.NameToLayer(VirtualWorldLayerName); if (LeftEyeLayer != -1) { prefabRig.VirtualCamera.cullingMask &= ~(1 << LeftEyeLayer); } if (RightEyeLayer != -1) { prefabRig.VirtualCamera.cullingMask &= ~(1 << RightEyeLayer); } if (PortalWorldLayer != -1) { prefabRig.VirtualCamera.cullingMask &= ~(1 << PortalWorldLayer); } }
private void UpdateSeeThroCamLayers(DualCameraIndex cameraIndex) { string layername = cameraIndex == DualCameraIndex.LEFT ? LefteyeLayerName : RighteyeLayerName; int mask = LayerMask.GetMask(layername); int layer = LayerMask.NameToLayer(layername); ViveSR_DualCameraRig prefabRig = PrefabUtility.GetCorrespondingObjectFromSource(ViveSR_DualCameraRig.Instance) as ViveSR_DualCameraRig; Camera cam = cameraIndex == DualCameraIndex.LEFT ? prefabRig.DualCameraLeft : prefabRig.DualCameraRight; ViveSR_TrackedCamera trackedCam = cameraIndex == DualCameraIndex.LEFT ? prefabRig.TrackedCameraLeft : prefabRig.TrackedCameraRight; ViveSR_TrackedCamera trackedCamAnother = cameraIndex == DualCameraIndex.LEFT ? prefabRig.TrackedCameraRight : prefabRig.TrackedCameraLeft; cam.cullingMask = mask; trackedCam.gameObject.layer = layer; trackedCam.Anchor.gameObject.layer = layer; trackedCam.ImagePlane.gameObject.layer = layer; trackedCamAnother.ImagePlaneCalibration.gameObject.layer = layer; }