Time for action – finishing the ArcBallCamera class
1. Add the
Constructor
region to theArcBallCamer
a
class as follows:#region Constructor public ArcBallCamera( Vector3 targetPosition, float initialElevation, float initialRotation, float minDistance, float maxDistance, float initialDistance, float aspectRatio, float nearClip, float farClip) { Target = targetPosition; Elevation = initialElevation; Rotation = initialRotation; this.minDistance = minDistance; this.maxDistance = maxDistance; ViewDistance = initialDistance; Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.PiOver4, aspectRatio, nearClip, farClip); needViewResync = true; } #endregion
2. Add the
View
property to theProperties
region of theArcBallCamera
class:public Matrix View { get { if (needViewResync) { Matrix transformMatrix = Matrix.CreateFromYawPitchRoll( ...