protected override void OnTick(float dt) {
base.OnTick(dt);
const float threshold = 0.001f;
if (_resetState > threshold) {
if (!AutoRotate) {
_resetState = 0f;
return;
}
_resetState += (-0f - _resetState) / 10f;
if (_resetState <= threshold) {
AutoRotate = false;
}
var cam = CameraOrbit;
if (cam != null) {
cam.Alpha += (_resetCamera.Alpha - cam.Alpha) / 10f;
cam.Beta += (_resetCamera.Beta - cam.Beta) / 10f;
cam.Radius += (_resetCamera.Radius - cam.Radius) / 10f;
cam.FovY += (_resetCamera.FovY - cam.FovY) / 10f;
}
_elapsedCamera = 0f;
IsDirty = true;
} else if (AutoRotate && CameraOrbit != null) {
CameraOrbit.Alpha += dt * 0.29f;
CameraOrbit.Beta += (MathF.Sin(_elapsedCamera * 0.39f) * 0.2f + 0.15f - CameraOrbit.Beta) / 10f;
_elapsedCamera += dt;
IsDirty = true;
}
if (AutoAdjustTarget && CameraOrbit != null) {
var t = _resetCamera.Target + new Vector3(-0.2f * CameraOrbit.Position.X, -0.1f * CameraOrbit.Position.Y, 0f);
CameraOrbit.Target += (t - CameraOrbit.Target) / 2f;
}
}