How to [properly] apply a force on an Area or RigidBody?

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

Given an object xi who should have forces applied to it by objects xj, how do I [properly] apply these forces on xi through GDScript?

:bust_in_silhouette: Reply From: kubaxius

Applying forces to RigidBody is pretty simple, you can do this via integrate_forces function, just edit PhysicsDirectBodyState passed to it. But you can’t directly apply force to Area – the main job of this node is to simply detect other bodies overlapping, entering, or exiting. If you want to move it, simply make it a child of RigidBody or KinematicBody, and then move its parent.