/// <summary> /// Configures the camera. /// </summary> /// <returns><c>true</c>, if camera was configured, <c>false</c> otherwise.</returns> /// <param name="camera">Camera.</param> /// <param name="eyePositionOffset">Eye position offset.</param> void ConfigureCamera(Camera camera, float eyePositionOffset) { OVRCamera cam = camera.GetComponent <OVRCamera>(); // Always set camera fov and aspect ratio camera.fieldOfView = VerticalFOV; camera.aspect = AspectRatio; // Background color camera.backgroundColor = BackgroundColor; // Clip Planes camera.nearClipPlane = NearClipPlane; camera.farClipPlane = FarClipPlane; #if OVR_USE_PROJ_MATRIX // Projection Matrix Matrix4x4 camMat = Matrix4x4.identity; OVRDevice.GetCameraProjection(cam.EyeId, NearClipPlane, FarClipPlane, ref camMat); camera.projectionMatrix = camMat; OVR_ForceSymmetricProj(false); #else OVR_ForceSymmetricProj(true); #endif // Set camera variables that pertain to the neck and eye position // NOTE: We will want to add a scale vlue here in the event that the player // grows or shrinks in the world. This keeps head modelling behaviour // accurate cam.NeckPosition = NeckPosition; cam.EyePosition = new Vector3(eyePositionOffset, 0f, 0f); }