Best Vertical Fall Implementation

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

I’m new using Godot Engine and i’m learning how to make a generic “Flappy Bird” Game, however when following the instructions i had some doubts. I read it is not recommended to use “set_position” or “linear_velocity” very often with a RigidBody2D, instead it’s better to apply forces to the object. Right now I’m using “set_axis_velocity” inside a func when the player Touch the Screen (then i led gravity make it fall).

1- Is this a good and correct implementation ?
2- There is any difference in this case between set_axys_velocity and linear_velocity ?
3- Should i have used the func physics process and delta ?

:bust_in_silhouette: Reply From: kidscancode

You should not set velocity or position in any way.

When you want to move a RigidBody2D you should use either the add_force() or apply_impulse()methods. Forces are constantly applied until removed, while impulses are instantaneous (like a kick).

In the case of Flappy Bird, you want to apply an upward impulse when the key is pressed.