Example #1
0
        private void updateCamera()
        {
            if (NavigationInfo.NavigationType == NavigationType.Examine)
            {
                // MOUSE ORBIT/PAN NAVIGATION
                if (mouseDragging)
                {
                    if (ispanning)
                    {
                        ActiveCamera.PanXY(mouseDelta.X * mouseScale, mouseDelta.Y * mouseScale);

                        //ActiveCamera.ScaleXY(mouseDelta.X, mouseDelta.Y);
                    }
                    else if (iszooming)
                    {
                        // orbits using shape's centerOfRotation
                        ActiveCamera.OrbitObjectsXY(mouseDelta.X / 0.5f, -1 * mouseDelta.Y / 0.5f);
                    }
                }
            }

            if (NavigationInfo.NavigationType == NavigationType.Fly || NavigationInfo.NavigationType == NavigationType.Walk)
            {
                // TEST new camera walk/fly implementation:

                Vector3 direction = Vector3.Zero;

                //if (Math.Abs(mouseDelta.X) > Math.Abs(mouseDelta.Y))
                //    direction.X = (dx > 0) ? 0.1f : -0.1f;
                //else
                //    direction.Y = (dy > 0) ? 0.1f : -0.1f;

                direction = new Vector3(mouseDelta);

                float xAngle = (direction.X);
                float yAngle = (direction.Y);

                ActiveCamera.ApplyYaw(xAngle);
                ActiveCamera.ApplyPitch(yAngle);
                ActiveCamera.ApplyRotation();
            }
        }