How to make InputEventScreenTouch echo

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

I haven’t done any android testing, so I don’t know if the answer of my question is in the device interaction or not but…

I’ve noticed that InputEventScreenTouch doesn’t echo. InputEventScreenDrag only echo’s while the mouse is moving. I don’t know how I would register someone holding their finger down on the screen (while not moving it) without having Godot use the emulate_mouse_from_touch in the project settings, and then using InputEventMouse

What’s the proper way this (ScreenTouch echo) is achieved?

:bust_in_silhouette: Reply From: deaton64

This is what I’ve used:

func _input(event):
if event is InputEventMouseButton:
	if event.button_index == BUTTON_LEFT and not event.pressed:
		_mousedown = false
		if _mousedown == false:
			_last_position = get_global_mouse_position()
		_mousedown = true

This lets me move a spaceship

Does this mean you’re using emulate_touch_from_mouse? (In the Godot project settings.)

Dumuz | 2021-06-24 19:49

I do.
Both emulate_touch_from_mouse & emulate_mouse_from_touch are set to on. I don’t know if they are both required, but it works with those settings for me.

The video was recorded on an Android phone. I’ve not tested it on an iPhone.

deaton64 | 2021-06-24 21:26