#Overriding mouse input

1 messages · Page 1 of 1 (latest)

opal crow
#

So, in my project I have full-screen shader that warps the visual (crt-style, rounds corners and warps everything). I would like to override all the mouse input that going through UI elements, so that mouse coordinates are warped in the same way, and buttons and elements are selected according to their visuals. AI seems to be gallucinating on this topic. I've tried to GetViewport().SetInputAsHandled(); and injecting changed input back with GetViewport().PushInput(inputEvent); but it seems to not be used for hover animation, which I would like to be affected too. Any help, guides, directions?

distant wigeon
#

Shaders go through the GPU and are "visual" only. So that's why the mouse cursor isn't warped, and is not working with the warped buttons.

However, this is the wrong way around to solve it:

I would like to override all the mouse input that going through UI elements, so that mouse coordinates are warped in the same way
You don't want/need to change the mouse input itself or whatever. The easiest approach here is setting a custom cursor in Godot (so you don't see/use the OS cursor), and then just apply the same shader(s) to the mouse. But this only works on the Godot cursor, since the OS cursor isn't "aware" of the in-game shader(s).

This would distort the mouse in the same way as the rest of the UI is distorted. Since these 2 distortions should be the same, the mouse will "work" again in terms of hitting the buttons as expected.

graceful saffron
#

If you want to go the route of overriding the mouse input, you could probably achieve this with some subviewport shenanigans