Smoothing fast movement for a fast moving object at 30 fps

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

Hello,

I have a simple project in which I have a Area2d which is dropping from the top of my screen to the bottom (resolution = 1080x1920 in portrait) with the following code:

extends Area2D

var speed = 800

func _physics_process(delta):
    position.y += speed*delta
	if position.y > 1920:
		queue_free()

When the game is running on my desktop the movement is quite smooth, but when I export it to an android apk the movement is much less smooth.

I believe it is because my game is running at around 35 fps on my phone. If I force the fps on my computer to be 30 fps I am able to reproduce this issue.

I can also get rid of it if I set a lower speed for the object.

My question is, how to smooth the movement of fast objects on a android that runs at 30 fps ?

Thanks for your help.

:bust_in_silhouette: Reply From: Yuminous

This is probably a result of the visuals being tied to the physics steps.

With fast movements and/or slow devices the rendering becomes visibly jerky as the visual frames do not interpolate (smooth) the steps out. This is a known limitation of the engine and is planned to be fixed in the future (4.0).

In the meantime there is an addon that exists specifically to solve this issue. You might be interested in trying it out: GitHub - lawnjelly/smoothing-addon: Fixed timestep interpolation gdscript addon for Godot Engine (version 3.2 or later)

Here is a video of what the addon does: