What is the difference between Physics Process and Integrate Forces?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Millard

Other than the fact that func _integrate_forces() deals only with rigidbodies and func _physics_process(delta) deals with kinematic bodies as well, I don’t understand when I should use integrate_forces. What is it’s purpose and when should I use it?

thanks. :slight_smile:

:bust_in_silhouette: Reply From: kidscancode

_physics_process() is called on every node during the physics processing step of the main loop. You should place code here that needs to be synced to the physics engine.

Because rigid bodies are controlled by the physics engine, you can’t just set their properties (such as position, etc) directly, as that would conflict with the physics engine’s calculations. When you do need to do something that would “break” physics, you have _integrate_forces(), where you can directly access and alter the body’s physics state.

You can read more about this, along with examples, here: Physics introduction — Godot Engine (stable) documentation in English

thanks, that will be helpful in future development!

Millard | 2020-11-01 00:12