protected override void OnUpdateFrame(FrameEventArgs e) { base.OnUpdateFrame(e); //get the time the frame will be displayed on the oculus double displayMidpoint = OvrDLL.ovr_GetPredictedDisplayTime(session, 0); //get the predicted position of the device at that time TrackingState ts = OvrDLL.ovr_GetTrackingState(session, displayMidpoint, true); //calculate eye poses Vector3[] eyeOffsets = new Vector3[2] { eyes[0].desc.HmdToEyeOffset, eyes[1].desc.HmdToEyeOffset }; Posef[] eyePoses = new Posef[2]; OvrDLL.ovr_CalcEyePoses(ts.HeadPose.ThePose, eyeOffsets, eyePoses); //get the orientation of the hmd if it was tracked if (ts.StatusFlags.HasFlag(StatusBits.OrientationTracked)) { eyes[0].pose.Orientation = eyePoses[0].Orientation; eyes[1].pose.Orientation = eyePoses[1].Orientation; } else { eyes[0].pose.Orientation = Quaternion.Identity; eyes[1].pose.Orientation = Quaternion.Identity; } //get the position of the hmd if it was tracked if (ts.StatusFlags.HasFlag(StatusBits.PositionTracked)) { eyes[0].pose.Position = eyePoses[0].Position; eyes[1].pose.Position = eyePoses[1].Position; } else { eyes[0].pose.Position = Vector3.Zero; eyes[1].pose.Position = Vector3.Zero; } }