Problems with Mouse pressure

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By sleepprogger

I want to support drawing tablets in my game and have two questions regarding pressure:

  1. The only way to get the current pressure i found is via the InputEventMouseMotion event. Is there some way to get the current pressure in a InputEventMouseButton (or other events) i missed ?

  2. How to detect if the device supports pressure at all ?
    In my tests real mouse pressure is always 0, but i can’t use this to decide as my tablet also occasionally produce motionEvents with the pressure set to 0 (mostly just when i stop drawing).

I opened an issue in godot_proposals regarding #2 : Add a way to detect if an input device supports pressure · Issue #426 · godotengine/godot-proposals · GitHub
If someone else needs that feature let it be known there so it’ll get implemented :wink:

Hi…How do you use it? I have a wacom tablet, I try this:

func _input (event):
    if (event is InputEventMouseMotion):
        print (event.get_pressure ())

and it always returns 0, the same with the mouse.

estebanmolca | 2020-01-31 19:28

@ estebanmolca: Thats how it should work. If it doesn’t for you you probably have some driver problem or a godot bug. Try if the pressure works in GIMP by using dynamic settings (Basic Dynamic fe.) for the brush.

sleepprogger | 2020-01-31 19:30

yes, in gimp and in the control panel of the tablet the pressure works, I will follow this question and I also saw your problem in github. Thank you very much if I find something useful I tell you.

estebanmolca | 2020-01-31 19:44

:bust_in_silhouette: Reply From: maze_maze

You should use it like this:

func _input(event):
	if event is InputEventMouseMotion:
		print (event.get_pressure())