+1 vote

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 : https://github.com/godotengine/godot-proposals/issues/426
If someone else needs that feature let it be known there so it'll get implemented ;)

in Engine by (121 points)
edited by

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: 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.

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.

1 Answer

0 votes

You should use it like this:

func _input(event):
    if event is InputEventMouseMotion:
        print (event.get_pressure())
by (20 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.