0 votes

I was wondering if I could use groups or custom resources to make a global gravity physics system in my 2D game so I could just call it in a script attached to a resource or a group and make all things have gravity as much as the player, enemies, objects, etc.

Godot version 3.3
in Engine by (12 points)

1 Answer

0 votes

Hi,
physics/gravity is allready global by default.
Have read through this?
https://docs.godotengine.org/en/stable/tutorials/physics/physics_introduction.html

When you create a rigid body it should receive the gravity force defiend in Project Settings->Physics->2d->Default Gravity

by (3,874 points)

But how do I implement the same physics i used in a player to an enemy if both are kinematic body 2D?

have a look here ...

https://docs.godotengine.org/en/stable/tutorials/physics/using_kinematic_body_2d.html

What is a kinematic body?

KinematicBody2D is for implementing bodies that are controlled via code. Kinematic bodies detect collisions with other bodies when moving, but are not affected by engine physics properties, like gravity or friction.

so, you either have to change your player and the enemies to rigid bodies or you have to imnplement your own physics/gravity system.

thaanksssssssss

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.