public void ForceClippingPlanes(MultiCamStyle style) { MultiCamCaptureObject obj = m_CaptureObjects[(int)style]; TrTransform xf = TrTransform.FromTransform(obj.m_CameraComponent.transform); float scale = App.ActiveCanvas.Pose.scale; obj.m_CameraComponent.nearClipPlane = obj.m_CameraClipPlanesBase.x * scale; obj.m_CameraComponent.farClipPlane = obj.m_CameraClipPlanesBase.y * scale; Debug.Log($"machk: forcing clip: {obj.m_CameraClipPlanesBase.x}->{obj.m_CameraClipPlanesBase.y} x{scale}"); }
public void UpdateAllObjectCameraTransform(Transform xf, float videoCameraLerpT) { for (int i = 0; i < m_CaptureObjects.Length; ++i) { MultiCamCaptureObject obj = m_CaptureObjects[i]; if ((MultiCamStyle)i == MultiCamStyle.Video) { UpdateObjectCameraTransform(MultiCamStyle.Video, xf, videoCameraLerpT); } else { obj.m_Camera.transform.position = xf.position; obj.m_Camera.transform.rotation = xf.rotation; } } }
public void UpdateObjectCameraTransform(MultiCamStyle style, Transform xf, float cameraLerpT) { MultiCamCaptureObject obj = m_CaptureObjects[(int)style]; // For the mobile version we need to adjust the camera fov so that the frustum exactly matches // the view through the viewfinder. The camera is placed at the vr camera position. if (!App.PlatformConfig.EnableMulticamPreview) { obj.m_Camera.transform.position = App.VrSdk.GetVrCamera().transform.position; obj.m_Camera.transform.rotation = xf.rotation; float distance = (xf.position - obj.m_Camera.transform.position).magnitude; float height = obj.m_Screen.transform.localScale.y * 0.5f; float fov = 2f * Mathf.Atan2(height, distance) * Mathf.Rad2Deg; obj.m_CameraComponent.fieldOfView = fov; obj.m_CameraComponent.nearClipPlane = distance; } else { obj.m_Camera.transform.position = Vector3.Lerp(obj.m_Camera.transform.position, xf.position, cameraLerpT); obj.m_Camera.transform.rotation = Quaternion.Slerp(obj.m_Camera.transform.rotation, xf.rotation, cameraLerpT); } }