public override void MoveMouse(Point point) { currentMouseMove.X += point.X; currentMouseMove.Y += point.Y; float xPer = (float)currentMouseMove.X / viewSize.Width; float yPer = (float)currentMouseMove.Y / viewSize.Height; TargetCamera tCam = (TargetCamera)camera; // calculate position on sphere surface float xRad = (float)(xPer * Math.PI * 2f); float yRad = (float)(yPer * Math.PI); //float zRad = (float)(point.Y * Math.PI * 2f); float x = (float)Math.Cos(xRad) * radius; float z = (float)Math.Sin(xRad) * radius; float y = (float)Math.Sin(yRad) * radius; tCam.Position = tCam.Target + new Vector3(x, y, z); }
public SphericalRotationHandler(Size viewSize, TargetCamera camera, float radius) : base(viewSize, camera) { this.radius = radius; }