No announcement yet.

Mouse lock prevents infinite rotation around Z/Yaw

  • Filter
  • Time
  • Show
Clear All
new posts

    Mouse lock prevents infinite rotation around Z/Yaw

    I want to create a top down camera/player setup where I have an alternative control scheme where pressing RMB will rotate the camera and let the player aim towards that direction, so that you can look a round instead of having a fixed camera angle.

    The problem is that the mouse axis x/y gets clamped by the window or screen borders, depending on the locking mode. I want to use only raw mouse movement as input though, not the movement of the cursor. Here is a short video of the issue. Basically I want to be able to turn around as often as my desk allows it.

    I'm searching for hours now and couldn't really find a solution that worked for me. I'm a env artist and don't know much about blueprints and game dev in general, hope someone here can help me.

    Thanks in advance

    I have a somewhat similar setup, although it's a third-person game.

    1) In my player controller, when I get On Right Mouse Button Down, I set the input mode to Game Only, and set a flag
    2) In On Right MouseButton Up, I set the input mode back to Game and UI, and clear the flag
    3) For the "input axis yaw" and "input axis pitch" inputs, I switch on the flag, and ignore them if it isn't set
    4) Additionally, I bind the left button down to "forward" and also switch that event on the flag

    This means that I can hold the right mouse button to pan the camera around, and press left button while right is down to mouse-run. When the right button comes up, the cursor comes back, and I can click whatever in the UI or the game.

    I also have regular movement keys (WASD, arrow keys) that always work.


      nice, thank you so much - it worked.

      I was handling the control switching already with flags (I suppose you mean setting a boolean like "button_pressed"), and if this flag is set you execute the view around logic.

      What I did was just to add that Input Mode Game Only and set the show mouse cursor to false when RMB is pressed. That already worked, but for redundancy, I added the Input Mode Game+UI node + the set show mouse cursor to true when the button is released.
      Click image for larger version

Name:	b61b3743c0588f932eb8a0e3af3ddb9d.png
Views:	30
Size:	126.3 KB
ID:	1851721