How can i predict the position of a rigidbody that has its velocity change based on the gravity equation?

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

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 / 
			var accel = force / mass
			add_central_force(accel * delta)

Do you have a concrete question?

sash-rc | 2021-08-08 10:46

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

Johnnyfantastic6 | 2021-08-08 23:04