void UpdateTracking(bool bSetInitial) { if (bSetInitial || PositionMode == MovementMode.Static) { // [TODO] should damp out jitter while allowing larger moves if (bStaticUpdated == false) { RootGameObject.SetPosition(ActiveCamera.GetPosition()); RootGameObject.SetRotation(Quaternionf.Identity); bStaticUpdated = true; } } else if (PositionMode == MovementMode.TrackOrientation) { RootGameObject.SetPosition(ActiveCamera.GetPosition()); RootGameObject.SetRotation(ActiveCamera.GetRotation()); } else if (PositionMode == MovementMode.CustomTracking && CustomTracker != null) { CustomTracker.UpdateTracking(this, ActiveCamera); } else { // MovemementMode.TrackPosition RootGameObject.SetPosition(ActiveCamera.GetPosition()); RootGameObject.SetRotation(Quaternionf.Identity); } // apply post-rotations Frame3f frame = RootGameObject.GetWorldFrame(); Quaternionf rotateLR = Quaternionf.AxisAngleD(frame.Y, ShiftAngle); Quaternionf rotateUp = Quaternionf.AxisAngleD(rotateLR * frame.X, TiltAngle); RootGameObject.SetRotation(rotateLR * rotateUp * RootGameObject.GetRotation()); // camera-tracking GO always tracks camera onCameraGO.SetPosition(ActiveCamera.GetPosition()); onCameraGO.SetRotation(ActiveCamera.GetRotation()); }