How to disable only Mouse input?

Hey all.
I couldn’t find any easy way to do it. The issue is - in my game, the player sits in the car but it’s not interactable to player cannot move their mouse or use any keyboard binding. Just sit in the car for traversing from 1 place to another.
I was using a simple “DisableInput” on game controller but that disables everything, the mouse and the keyboard. I still want the keyboard (to be precise, just the ESC key so that player can still pause the game) but it’s not happening as I don’t see any separate node for disabling keyboard.
(Reason I disable Input, is when I attach the player inside a car, the animations changes to a sitting state machine and if the mouse is active, then the whole player mesh starts to rotate, or say pivot about the socket, if mouse is moved in the car. I don’t want that)

2 Likes

if youre using the enhanced input create two contexts, say menu controls and player controls then remove the player mapping context when in a car

1 Like

Sadly I’m not. I just upgraded my project and Idk how they work and I don’t wanna change all inputs that were made before. Is there any alternative?

youd just have to use a bool after all the inputs you want disabled, set it to false when in a car and true when out

or you could put common inputs on the controller and movement inputs on the pawn and then just disable the input on the pawn only

1 Like

you can try to use these:
image

that will lock char movement or mouse.
and Reset Input Flag as well when the npc leaving the car.

Or use a context Enhanced Input like Auran suggested :innocent:

3 Likes

That will require some refactoring and testing and I really don’t want to change that much stuff as of now. But thanks for the suggestion.

Always to the rescue mate XD
Thanks. Lemme try this and will revert back :wink:

Edit - it worked. Thanks @Arodi007. Solution Marked.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.