Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public SphericalRotationHandler(Size viewSize, TargetCamera camera, float radius)
     : base(viewSize, camera)
 {
     this.radius = radius;
 }
Exemplo n.º 3
0
 public SphericalRotationHandler(Size viewSize, TargetCamera camera, float radius)
     : base(viewSize, camera)
 {
     this.radius = radius;
 }