How to temporarily disable mouse control

  • #1, by red363Wednesday, 09. February, 06:16 5 months ago

    Can you please tell me if the following problem can be solved:

    It is necessary that at the beginning (during the loading of the scene) the player could not move the mouse (cursor). Not just make it invisible, but disable the ability to move the mouse for a few seconds.

    After loading the scene, the cursor will move to the desired position (this is solvable).

    The problem is that if the player moves the mouse while the scene is loading, the cursor enters the "danger zones" and a certain

    Is there a way to disable mouse control, perhaps with a script?

    Thank you.


    58 Posts

  • #2, by afrlmeWednesday, 09. February, 14:59 5 months ago
    What's the danger zone?

    There's a few things you can do with the mouse.

    1. You can use the show/hide cutscene wrappers to disable mouse interaction & hide the mouse cursor, however the mouse cursor will still be visible if you specified a wait cursor in the main game settings section of the editor, but that can be edited via a line of code.

    game.WaitCursor = Cursors["example"]


    game.WaitCursor = emptyObject

    2. It's possible to prevent the mouse cursor from updating destination for left/right click, etc - see the mouse properties section under main game settings section of the editor. It's actually possible to update those with script too.

    Available arguments:
    eMouseActionBehaviourDoNotSendCharacter 0
    eMouseActionBehaviourSendCharacterToCursor 1
    eMouseActionBehaviourSendCharacterToObjects 2 

    Available mouse behaviours:

    Example [prevent destination tables from being updated]:
    game.LeftClickBehaviour = eMouseActionBehaviourDoNotSendCharacter

    3. You could create an interface (place it just below your command interface in the interface list) that contains a transparent png/webp image that is the same size as your default game resolution - don't forget to specify the interface area - & just show & hide that as needed. It should prevent the cursor from being able to detect anything underneath it.

    4. I really don't recommend this method as it wrestles control from the player & the player with be able to fight against it. You could use a loop that forces the mouse cursor into a specific position, but if the player is moving their mouse then the cursor will be jumping around, which isn't very aesthetically pleasing.


    7138 Posts

  • #3, by red363Thursday, 10. February, 05:14 5 months ago
    Thanks for the extended answer.

    The essence of my task is that the player does not change the position of the cursor in the first few seconds after loading the scene. There are zones in the scene when the cursor intersects with which certain actions are played (we can assume that in this scene the "protagonist" is the cursor)

    Whether it is possible to solve it somehow?

    (I’m currently solving this with an action in which the binding of the cursor to a certain position is looped. But the solution is so-so)


    58 Posts

  • #4, by afrlmeThursday, 10. February, 14:02 5 months ago
    It sounds like you went with solution 4, the one I mentioned that isn't the best of ideas. grin

    Are you talking about action areas or mouse enters/leaves actions?


    7138 Posts

  • #5, by red363Thursday, 10. February, 21:29 5 months ago
    Yes, that's right, solution 4.

    I'm talking about a mouse enters/leaves actions


    58 Posts

  • #6, by afrlmeFriday, 11. February, 02:05 5 months ago
    You can use the interface method I mentioned in solution 3. As long as the interface background & interface area is the same as (or larger than) the default game resolution & as long as the interface is placed at the top (or maybe underneath the interface containing your commands) it should prevent the mouse cursor from detecting anything below it.

    Though tehnically using hide/show cursor should also disable interaction & detection below the cursor too.


    7138 Posts

Write post