In a proof of concept I'm doing for a personal project, it's a KSP-like space rocket simulator
And I want to simulate the gravity that the rockets had with the planet at this moment
What am I doing?
Create a class called CelestialObject that will be the class for the planets, extend RigidBody and in the _physics_process function with a dictionary I run through a list in which the Rigid Bodies that will be affected by the gravity of this planet are stored and each one I apply a force centered with the planet's gravity and to the direction in which it is
Code:
func _apply_gravity(object: RigidBody, delta: float):
var force: Vector3 = Vector3(0, object.mass -Gravity delta, 0).direction_to(self.transform.origin)
object.apply_central_impulse(force)
What is the problem? that the body moves too slow
Why don't I use an Area and check the gravity point box for it? That was the idea, but a problem arose that did not let me continue with it, the spherecollisions have a maximum size that I do not remember right now and in my proof of concept I want to represent the planets 1: 1
He also had another alternative which was to generate a concavecolillon based on a Mesh Instance, but the point of gravity did not work with him
I could go to Unity since there are many examples of how to do planet physics without problems and also where KSP was created, but I do not know the Engine very well and I would prefer it to be godot since I have more control and I know how it works