Clarification on the use of _process() vs _physics_process()

Godot Version

4.7

Question

I am interested to know what use cases _process() has in modern Godot.

We now have Physics Interpolation that can smoothen out movements triggered in _physics_process(), providing smooth but consistent behaviour.

We also have the two AnimationMixer node types, which allow for animations to be scripted without code.

I’m not saying there aren’t any use cases, I am just curious for some examples, even if they’re niche.

(for the record, the information in this post is based on my experience with 2D Godot. I’ve not touched 3D so my information may be inaccurate for that side of the engine.)

_process() is for visual frames.
There might be some cases where the interpolation will give you wrong tweened values on some effects, so you do the actual real value computation on _process().
You can run lighter stuff at over 100Hz on _physics process and run the rendering loop at 60hz for more accurate high-speed physics, or you can subsample expensive physics at 30Hz and enable interpolation up to 120Hz. Each game will have its own requirements.

  1. For things that are framerate-independent.
  2. You can turn _process() and _physics_process() on and off separately for a node, so if you have things that are always on, like processing gravity, you can put them in _physics_process(), and you can put things like input that you might want to turn off occasionally for minigames in _process(). (You can also process input in _input() or _unhandled_input().)
  3. If you change the physics framerate, _process() still runs at the same rate.

Thanks for your answers :slightly_smiling_face:

For especially updating visual stuff, _process() results in a more responsive feel. For example, if you’re making a custom mouse cursor, having the code for it in _process() will give you a responsive mouse cursor because it updates the position each frame.

func _process() -> void:
    mouse_cursor.global_position = get_viewport().get_mouse_position()

If you’re directly moving / rotating an object with code, for example a car wheel visual or a camera, rotating it in _process() will result in a much smoother visual rotation. But other than that, _physics_process() is the way to go in my experience.