This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+2 votes

Does _physics_process on nodes get called in strict deterministic order or it is gets called in arbitrary, unpredictable order?
Can we control and reorder this?

My goal is always update moving platforms before player & enemy or any other character.

in Engine by (21 points)

3 Answers

+2 votes

_physics_process and _process both seem to be called in pre-order traversal from the root node (basically, nodes are processed in order from the top to the bottom of the scene view). There doesn't seem to be a way to change this order. I would urge against designing anything that relies on the order of update calls, though.

by (526 points)
0 votes

In a well designed engine/game, all physics movement is calculated at one time, then the reactioned are then calculated. For instane, if you were playing Street Fighter 2 and you both hit each other at the same time, what happens is that you both receive damage. But, in a badly deigned game, the player who was calculated last in the code is the one who gets hit.

This is a more in depth article (but not too in depth):

I have no doubt this is how Godot works: it calculates all movement at the same time. It's always best to rely on the Godot engine to do all the work, as it is written by people who have years of experience in games and game engines. If you want the platforms to have precedence, I would recommend using a static body and just moving those around.

by (33 points)

"It's always best to rely on the Godot engine to do all the work, as it is written by people who have years of experience in games and game engines."

Truth be told, 'Kinematic Character' demo is awful: unresponsive player controls, character lags after moving platform, jumps on down moving platform, moving on slopes is terrible.

agree. Now I found that Godot 3.0 has bugs on the physics side...

Here, check this:

0 votes

If you have a scene tree like this:


the _physics_process call order would be A,D,E,B,C,F.
Now if you were, for example, to set F's process priority to -1, and D's process priority to 1, the call order would change to F,A,E,B,C,D

I tested this by creating a scene tree where every node just prints their name during the _physics_process. According to it, Godot will process in the exact order in which the nodes are listed in the tree view, ignoring parentage, provided they all have the same process priority (which by default is 0 for all nodes).

by (18 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.