예제 #1
0
        protected virtual void OnKeyboardMoveCamera(KeyRoutedEventArgs e)
        {
            var f = IsCtrlKeyPressed() ? 0.25f : 1;

            switch (e.Key)
            {
            case VirtualKey.W:
                OnAddMoveForce?.Invoke(Viewport, new AddForceEventArgs(new Vector3(0, 0, 0.1f * f * (float)Viewport.MoveSensitivity)));
                break;

            case VirtualKey.A:
                OnAddMoveForce?.Invoke(Viewport, new AddForceEventArgs(new Vector3(0.1f * f * (float)Viewport.LeftRightPanSensitivity, 0, 0)));
                break;

            case VirtualKey.S:
                OnAddMoveForce?.Invoke(Viewport, new AddForceEventArgs(new Vector3(0, 0, -0.1f * f * (float)Viewport.MoveSensitivity)));
                break;

            case VirtualKey.D:
                OnAddMoveForce?.Invoke(Viewport, new AddForceEventArgs(new Vector3(-0.1f * f * (float)Viewport.LeftRightPanSensitivity, 0, 0)));
                break;

            case VirtualKey.Z:
                OnAddMoveForce?.Invoke(Viewport, new AddForceEventArgs(new Vector3(0, -0.1f * f * (float)Viewport.LeftRightPanSensitivity, 0)));
                break;

            case VirtualKey.Q:
                OnAddMoveForce?.Invoke(Viewport, new AddForceEventArgs(new Vector3(0, 0.1f * f * (float)Viewport.LeftRightPanSensitivity, 0)));
                break;
            }
        }
예제 #2
0
 protected void RaiseOnAddMoveForce(AddForceEventArgs args)
 {
     OnAddMoveForce?.Invoke(Viewport, args);
 }