Question: When should you use _process and _physics_process in Godot?


In Godot, both _process(delta) and _physics_process(delta) are callback functions that are called every frame, but they serve different purposes and are synchronized with different parts of the engine's loop cycle.


Use _process(delta) when you need to update something on every frame regardless of the physics. This is where you put your code for anything that doesn't require precise synchronization with the physics engine, such as:

  • Animating sprites or UI elements
  • Handling game logic that isn't physics-related
  • Updating non-physics game state

The delta parameter represents the time elapsed (in seconds) since the last frame. It helps ensure that updates occur at a consistent rate, regardless of frame rate variations.

Here's an example of using _process(delta):

func _process(delta): # Rotate a node at a constant rate rotation_degrees += 90 * delta


On the other hand, _physics_process(delta) is specifically designed to run in sync with the physics engine. This means it's called at a fixed interval, ensuring consistent physics simulation. Use _physics_process(delta) for:

  • Moving objects using the physics engine (e.g., RigidBody, KinematicBody)
  • Checking physics interactions like collisions
  • Applying forces or impulses to physics bodies

Similar to _process, the delta parameter here indicates the fixed amount of time between physics frames, ensuring consistent physics behavior.

Here's how you might use _physics_process(delta):

func _physics_process(delta): # Apply a constant force to a RigidBody if Input.is_action_pressed("ui_up"): $RigidBody.apply_central_impulse(Vector3(0, -10, 0) * delta)

Key Differences

  • _process(delta) is called every frame and its frequency can vary depending on the frame rate.
  • _physics_process(delta) is called at a fixed frequency, matching the physics tick of the engine, which by default is 60 times per second.

It's important to choose the right function based on what you need to achieve in your game for smooth gameplay and accurate physics simulation.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Start building today

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.