godot_recipes icon indicating copy to clipboard operation
godot_recipes copied to clipboard

[Discussion] Basics: Understanding 'delta'

Open cbscribe opened this issue 4 years ago • 4 comments

Discussion for http://godotrecipes.com/basics/understanding_delta/

cbscribe avatar Feb 03 '21 02:02 cbscribe

Hi cbscribe.

How is 0.033 computed?

Code snippet

`Acceleration in pixels/sec/sec. var gravity = Vector2(0, 120)

Acceleration in pixels/frame/frame. var gravity_frame = Vector2(0, .033) `

Thank you.

carlomontoyaph avatar Jun 22 '21 12:06 carlomontoyaph

How is 0.033 computed?

Because this example is using 120 pix/sec/sec for gravity, the per-frame acceleration is going to be 120 * (1/60) * (1/60) = 0.033. This is so that you can see the difference by setting use_delta and changing the FPS.

cbscribe avatar Jun 22 '21 14:06 cbscribe

How were you able to display an fps counter and a toggle for delta?

Griiim24 avatar Jul 26 '22 08:07 Griiim24

How were you able to display an fps counter and a toggle for delta?

A SpinBox node and a CheckButton node.

cbscribe avatar Jul 26 '22 14:07 cbscribe