Issue with RigidBody2D response to SCREEN_DRAG event on android

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By sandheaver
:warning: Old Version Published before Godot 3 was released.

I am trying to create an inertial vertical scrolling effect for an android app (the kind you see when scrolling through a list).

To do this, I am using a RigidBody2D node to listen for a SCREEN_DRAG input event then to set it’s linear velocity on the y-axis to the speed of the screen drag event. I will then attach any items I need to scroll to the RigidBody. The RigidBody2D has a Gravity Scale of 0 and a linear damping overide set to slow it down.

extends RigidBody2D

func _ready():	
  set_process_input(true)

func _input(event):
  if event.type == InputEvent.SCREEN_DRAG:			
		set_linear_velocity(Vector2(0,event.speed_y))			

Everything works exactly as planned when I run the project in the onboard project player, using the mouse set to emulate touchscreen in project settings. However, when I export to android the RigidBody2D won’t move in response to a drag event. I can see in logcat that an input event is being detected.

If I try a simpler non-inertial approach, for example, just moving the RigidBody2D node in response to a drag event with:

move_local_y(event.relative_y)

then everything works fine in the exported android version, but I’m after an inertial effect and I thought using the physics body’s velocity or impulse functions would be the best way to achieve this.

I have put an example project here

I would welcome any advice, either how to fix the issue or how to achieve an inertial scrolling effect in a different way.