Esempio n. 1
0
        void myMouse_ButtonEvent(object sender, _3DxMouse.ButtonEventArgs e)
        {
            CameraParameters cameraParams;
            if ((e.ButtonMask.Pressed & 1) == 1)
            {
                CameraRotateTarget = 0;
            }
            if ((e.ButtonMask.Pressed & 2) == 2)
            {
                cameraParams = new CameraParameters(0, 0, 360, 0, 0, 100);
                GotoTarget(cameraParams, false, false);

            }
        }
Esempio n. 2
0
        void myMouse_MotionEvent(object sender, _3DxMouse.MotionEventArgs e)
        {
            if (e.TranslationVector != null)
            {

                // Swap axes from HID orientation to a right handed coordinate system that matches WPF model space
                SensorTranslation.X = e.TranslationVector.X;
                SensorTranslation.Y = -e.TranslationVector.Z;
                SensorTranslation.Z = e.TranslationVector.Y;
            }

            // Rotation Vector?
            if (e.RotationVector != null)
            {
                // Swap axes from HID orientation to a right handed coordinate system that matches WPF model space
                SensorRotation.X = e.RotationVector.X;
                SensorRotation.Y = -e.RotationVector.Z;
                SensorRotation.Z = e.RotationVector.Y;
            }
        }
Esempio n. 3
0
        bool InitSpaceNavigator()
        {
            try
            {
                myMouse = new _3DxMouse(Handle);
                var NumberOf3DxMice = myMouse.EnumerateDevices();

                // Setup event handlers to be called when something happens
                myMouse.MotionEvent += myMouse_MotionEvent;
                myMouse.ButtonEvent += myMouse_ButtonEvent;
                return true;

            }
            catch
            {
                myMouse = null;
                return false;
            }
        }