Disable screen dragging in game and UI mode

Hello!
I’m in the process of creating a drag & drop functionality for actors on the map using a gizmo. In order to prevent the screen from rotating as the mouse moves, I changed the current input option to “Game and UI”. It works great, but when you click on the gizmo’s arrow and drag it, the camera - attached to the player’s actor with the spring arm - moves with the mouse. Is there any way to lock the camera permanently?
The second option is to change the input option to “UI Only”, but then I have to create a dummy widget, attach input to it - which I tried to do with poor results.

Are you using a custom pawn or the default pawn for this?

It’s my own Pawn, child of SpectatorPawn

And the spectator pawn inherits from the Default Pawn - that’s what allows you to move and look around:

image

I understand. What can I do with that?

The input bindings that allow you to move around and control the pawn are implemented on C++ level, and a part of the default pawn. The bindings can be disabled but it cannot be done dynamically - so you’d lose the ability to move the pawn completely.

So you have 3 options (that I can think of):

  • dig into the Default Pawn and get rid (or re-write) of that part of the C++ code responsible for rotating the camera when the mouse buttons goes down
  • script your own movement method from scratch; if you’re a level designer or into archviz that’s probably not a great use of you time
  • temporarily disable input on the Pawn when you click the Gizmo:

image

And enable it back once you’re done interacting with the Gizmo.

Thank you, I will think about those options. Have a nice day!

1 Like

I have not tested it thoroughly but perhaps you could call this before you start dragging the Gizmo:

image

This way you can still move the pawn but the mouse movement will not be applied.

1 Like

Wow, I thought you would settle for the very good previous advice, but I can see that I gave you quite a nuisance.
Problem solved:

  1. I disabled “Add default movement bindings” in my character class
  2. I wrote events by hand to handle motion events. Thanks to this, I can use branch to decide when the mouse movement will be taken into account and when not.

Thank you very much for your help. You are great!

1 Like