0 votes

so i have a simulation of planets with gravity and i need to be able to see where they are going to be later on in the sim (so i can set up orbits and such)

my code:

extends RigidBody

func _physics_process(delta):
    for other_object in get_tree().get_nodes_in_group("GravAffected"):
        if self != other_object:
            var force_dir = translation.direction_to(other_object.translation)
            var force = force_dir * SimSettings.GRAV_STRENGTH * (mass * other_object.mass / 
            translation.distance_squared_to(other_object.translation))
            var accel = force / mass
            add_central_force(accel * delta)
Godot version v3.3.stable.official
in Engine by (36 points)

Do you have a concrete question?

nvm i got it i just redo the formula on a marker sprite and add it to the tree

Please log in or register to answer this question.

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.