InputEventScreenDrag "relative" vector magnitude is not relative to the start position as documentation suggests

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

Hi there,

Maybe I’m not using InputEventScreenDrag properly, but it seems like the event’s “relative” vector2 values are relative to the last frame position versus the start position as the documentation suggests.

My code is very simple:

func _unhandled_input(event):
     if event is InputEventScreenDrag and event.index == 0:
          touch_position = event.get_position()
          touch_vector = event.get_relative()
          touch_speed = event.get_speed()

I then have another block of code outputting the values every frame:

     if debug:
		debug_text.text = "" \
		+ "TOUCH POSITION: " + str(touch_position) + "\n" \
		+ "TOUCH VECTOR: " + str(touch_vector) + "\n" \
		+ "TOUCH SPEED: " + str(touch_speed) + "\n" \

What’s happening when I drag slowly is the touch vector magnitude is at 0.333… so my guess as to what’s likely happening is it’s constantly updating the ‘start’ position to be the position of my touch in the previous frame, versus being the overall start position of the drag/touch.

Am I doing something wrong here? Or misreading the documentation / misunderstanding how drag relative is supposed to work?

Reason I ask is this means I need extra code to record the first general touch and it’s position, and then calculate the real relative drag vector magnitude.

Hopefully the above is clear… any help is greatly appreciated!