Best way to know when to use delta (Godot)

There is no problem if I use delta in both _process or _physics_process , using methods that may or may not involve physics or if I perform any kind of movement based on position or global position, right?(except move_ad_slide())
Is this a bad practice?

Can you tell me when is the best moment to use that? It make sense if I use delta for moving with position/global position or rotation

Thanks for your attention

HI and welcome to the community :wave:

sorry i missed this one.

theres a few different things to consider with using delta or not.

primarily its used to ensure frame rate independence so things can happen smoothly over time, even when the time it takes to draw each frame to the screen can be slightly different.

so this comes down to using it within _process()

moving nodes around the scene we use delta here to smooth movement out.
since ‘FPS’ is how many frames are drawn to the screen each second. which directly relates to how many times _process() is called each second.

with regards to using it within the physics_process()

there isnt too much call to use it here, generally. with physics objects, there are moved around the screen via physics forces being applied or being acted upon by them.

but, there are some cases that i can think of, like if you were to set an acceleration within physics.
or a specific method call doesnt automatically use delta.

heres a topic from KidsCanCode that covers it better than i can ramble on :slight_smile:

< Understanding ‘delta’ :: Godot 4 Recipes (kidscancode.org)>

Privacy & Terms