Your code confuses me, but as far as I can tell you’re calculating the vector from the origin to the spaceship, rather than from the planet to the spaceship. Then you draw a line from the planet to the end of the vector. So it seems to me the drawLine function is fine, but your vector calculation is wrong.
 here’s a modified version of gravitySimulator.py:- though I seem to have accidentally normalized the vector somewhere in the script, I’ve only just found out about the Vector() function and I don’t quite have the gist of it yet. I compensated by multiplying the result of the getVectTo with getDistTo- even though getVectTo should already be the proper length. Sorry for the convolution.
def __init__(self, planet, spaceship):
self.planet = planet
self.spaceship = spaceship
from Mathutils import Vector
factor = .6
vector = Vector(self.planet.getVectTo(self.spaceship.worldPosition)) * self.planet.getDistanceTo(self.spaceship) * factor
Rasterizer.drawLine(self.planet.worldPosition, vector + Vector(self.planet.worldPosition), [0.0, 1.0, 0.0])
You not only have to get the vector from the planet to the spaceship, for the sake of the DrawLIne function you also have to add the planet’s position to the vector.