protected override void UpdateView(ref ViewParams viewParams) { if(zoomingOut && ZoomLevel > 1) { ZoomLevel -= zoomSpeed; if(ZoomLevel < 1) ZoomLevel = 1; } else if(zoomingIn && ZoomLevel < maxZoomLevel) { ZoomLevel += zoomSpeed; if(ZoomLevel > maxZoomLevel) ZoomLevel = maxZoomLevel; } viewParams.FieldOfView = MathHelpers.DegreesToRadians(60); var distZ = minCameraDistanceZ + (minCameraDistanceZ - maxCameraDistanceZ) * ZoomRatio; if(IsSpectating) { viewParams.Position = Position + Rotation * new Vec3(0, -10, 5); viewParams.Rotation = Quat.CreateRotationVDir(Rotation.Column1); } else { viewParams.Position = Position + new Vec3(0, cameraDistanceY, distZ); viewParams.Rotation = Quat.CreateRotationXYZ(new Vec3(MathHelpers.DegreesToRadians(minCameraAngleX + (minCameraAngleX - maxCameraAngleX) * ZoomRatio), 0, 0)); } }
/// <summary> /// Called to update the view associated to this actor. /// </summary> /// <param name="viewParams"></param> protected virtual void UpdateView(ref ViewParams viewParams) { }