]> git.itanic.dy.fi Git - sdl-planets/commitdiff
gravitize_planets: Fix approximation from the gravity equation
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 20 Mar 2010 12:08:18 +0000 (14:08 +0200)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 20 Mar 2010 12:08:18 +0000 (14:08 +0200)
This was needed when there was no collosions between the planets and
the planets could "explode" when they got too close to each others.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
planet.c

index 9e44e099e623c831ee41d0da54319b1ad10032b4..166d8400f1c3269a2640850f21b8e8fdc16bcd35 100644 (file)
--- a/planet.c
+++ b/planet.c
@@ -95,7 +95,7 @@ int gravitize_planets(struct planet *a, struct planet *b, const double time)
 
        vector_div(&distance, dist, &distance);
 
-       f = a->mass * b->mass / (dist * dist + 5) * time;
+       f = a->mass * b->mass / (dist * dist) * time;
 
        acc = f / b->mass;
        vector_scale(&distance, acc, &sum);