Beispiel #1
0
    public override void _Input(InputEvent @event)
    {
        if (Main.i.gameInputActive == false)
        {
            return;
        }
        InputEventMouseMotion motion = @event as InputEventMouseMotion;

        if (motion == null)
        {
            return;
        }
        _fpsCtrl.ProcessMouseMotion(motion, ZqfGodotUtils.GetWindowToScreenRatio());
    }
Beispiel #2
0
        public void ProcessMouseMotion(InputEventMouseMotion motion, Vector2 screenRatio)
        {
            float sensitivity = MOUSE_SENSITIVITY;

            Vector2 ratio      = ZqfGodotUtils.GetWindowToScreenRatio();
            float   mouseMoveX = motion.Relative.x * sensitivity * ratio.x;

            // flip as we want moving mouse to the right to rotate left
            mouseMoveX = -mouseMoveX;
            _yaw      += mouseMoveX;

            float mouseMoveY = motion.Relative.y * sensitivity * ratio.y;

            _pitch += mouseMoveY;
        }