|Topic was automatically imported from the old Question2Answer platform.
Hi, I want the mouse to be captured in a specific area, so not the whole screen. Is there a way to do this?
You could check the mouse position and hide it when it matches the region. Do you also want the cursor to be stuck there or do you just want to hide it?
1234ab | 2020-03-26 13:01
I want it to be stuck, so when you drag and drop an item you can’t drag it out of the area.
rubendw03 | 2020-03-26 13:08
Oh and you want the mouse to be stuck also, or only the thing you drag? If the mouse too, you could set the mouse position every frame Viewport — Godot Engine (latest) documentation in English, but IMO it won’t look nice (if not hidden).
1234ab | 2020-03-26 13:16
So I have the drag and drop thing working but how do i keep the mouse in this new viewport?
rubendw03 | 2020-03-26 13:51
Well I’m quite new too but I would say try that warp_mouse method to set the mouse cursor position every (physics)process while you want the cursor to be stuck.
1234ab | 2020-03-26 13:58
Okay I’ll figure that out thanks!
rubendw03 | 2020-03-26 14:07