#help a dumb guy with delta and _physics_process

1 messages · Page 1 of 1 (latest)

hardy mica
#

so delta is the time passed between 2 frames and physics process updates at a fixed rate, so with the fixed rate of the physics process when do i actually need to multiply stuff by delta i thought i understood it until i actually thought about it

#

like let's say i multiply something in physics process by delta vs don't multiply it what would the difference be

lucid copper
#

ye, use the given delta that's passed into the function

hardy mica
#

so i do need to use it

#

then what's the difference between physics process and process

lucid copper
#

you said it yourself. Physics runs at a fixed rate

hardy mica
#

then why do i need delta for it

lucid copper
#

there was a good godot doc about it all let me see if I can find it

hardy mica
#

alr

lucid copper
#

that's one thing godot is good at vs unity. Good documentation lol

hardy mica
#

alr tyvm i'll check it out

#

oh i see it's to prevent it slowing down due to lag alr

#

and not to prevent it from speeding up if it runs fast

lucid copper
#

the idea is you're promised that the physics will update a number of times per second (50-60), but that doesn't mean it's completely consistent which is why you still need to use the delta

hardy mica
#

yea i see\

cloud heart
#

So say you want to move a character in the process function,

If you want to move him to the left by 1 pixel evey frame
If your pc goes to 60 FPS you character moves to the left by 60 pixel in a second
Say your pc goes to 120 FPS your character would move by 120 pixel to the left every second

#

So
1pixel * 10 FPS = 10 pixel per second
1pixel * 60 FPS = 60 pixel per second
1pixel * 120 FPS = 120 pixel per second

#

Now the delta is:
The time elapsed since the previous frame, aka 1/FPS

#

So
1pixel * 10 FPS * 1/10 FPS = 1 pixel per second
1pixel * 60 FPS * 1/60 FPS = 1 pixel per second
1pixel * 120 FPS * 1/120 FPS = 1 pixel per second

#

That's how you use it, for things that are dependent of the framerates

hardy mica
#

yea i know that

cloud heart
#

Now if it's fixed doesn't mean it's not gonna drop framerate, so you would still need to multiply by delta

hardy mica
#

i'ma sking about physics process not process

#

yea ok i got that now