the gravity problem

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

how would you do a gravity system that works like this; https://www.youtube.com/watch?v=QLH_0T_xv3I

(gravity changes based on what area your player’s kinimaticbody is)

:bust_in_silhouette: Reply From: Lopy

You can use Areas for that. Both Area2D and Area3D have properties to alter the gravity of nodes inside them. See space_override and the various gravity_… properties they have.

Alternatively, you could manually detect when the player enters the Area using their body_entered signal, and implement a custom gravity that way.

Here’s an article from the official documentation on how to use an Area2D to modify gravity. The properties can also be applied to an Area node (with some modification, of course).

Ertain | 2021-02-07 01:27