0 votes

Hello! I was trying to get the global position based on where the finger has touched on a mobile touchscreen, somewhat similar to the function: get_global_mouse_position() where the mouse global position is captured. I thought this was done by using this code:

func _input(event):

    if event is InputEventScreenDrag:
        touch_position = event.position

The touch_position represents the Vector2() coordinates based on the event.position. Unfortunately though this only captures the position the finger is touching on the screen. Say that my resolution screen size is set at 400x224 pixels then I can only get the position in that range such as 345x120 or 20x200 pixel position. is there a better way to get the global position capture based on the position of the touchscreen resolution limit?

asked May 16 in Engine by Corruptinator (154 points)

Unfortunately though this only captures the position the finger is touching on the screen.

I'm not certain 100% what you're asking for.

  1. Do you want a more precise location of the finger touch?
  2. Is the location you get not accurate enough?
  3. Do you want to require that the user make more accurate finger placement?

Please log in or register to answer this question.

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.