0 votes

I want to make a KinematicBody/sprite which is always at where the players finger (mobile) is. Without input lag. Precision is very important. This is in 2D.

Godot version v3.4
in Engine by (46 points)

1 Answer

0 votes
func _unhandled_input(event):
   if event is InputEventScreenTouch and event.pressed == true:
       (event.position)  # the position of the touch

Literally an example in the docs: https://docs.godotengine.org/en/stable/tutorials/inputs/input_examples.html#touch-events


InputEventScreenTouch is equivalent to a mouse click event, and InputEventScreenDrag works much the same as mouse motion.

by (834 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 Frequently asked questions and 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 [email protected] with your username.