#Process Vs Physics Process

1 messages · Page 1 of 1 (latest)

summer obsidian
#

I did have a read through some of the past posts and i think i've got it but just wanted to check!

This is an example script for one of my enemies movement code, which is a Node2D with an AnimatedSprite2D not a physics body, have i split the code between the two correctly or do i not need physics process at all?

-- I don't have physics interpolation on if that helps

uneven light
#

You don't need physics process. What you've done is reasonable.

summer obsidian
uneven light
#

The only difference is that physics process runs at a maximum rate (and therefore in good circumstances at an exact rate too 😁), while process runs as frequently as it can while obeying the previous statement

summer obsidian
#

Yeah so am i right in thinking the physics process would be more resource intensive especially on lower end setups?Appreciate the comment!

uneven light
#

My guess is no, actually. That most devices run process (~monitor rate; could be 90, 120hz) more frequently than phys_process (60hz by default)

summer obsidian
#

Okay got you

uneven light
#

Though the two are really not in any fixed relationship, either order could happen

summer obsidian
#

Makes sense so my previous thinking is probably not likely then, i used to have everything in process but i was told to move it all the physics code into physics process when i had physics interpolation on, but now i've removed that and disabled it so i was going to move the code back to process in attempt to help but it might not really make any difference

dense arrow
#

I dunno if this is sane, but I've been separating duties between them too. PhysicsProcess is for data crunching (damage application, healing, intended path positioning, etc) and then Process is for any rendering based stuff. So My enemies, say, have their positions calculated in physics process, and they move along those positions via Process.

Seems like you're doing something similar. So you're clearly a genius.