@ -42,7 +42,7 @@ end
window = Window.new("Physics!", 1600, 900)
planet = Planet.new("Earth", window, 0xff_aaffaa)
planet = Planet.new("Earth", window, 0xff_aaffaa, 0.0001)
planet.pos = Vector[800, 450]
cube = PhysCube.new("Cube", window, 8, 8)
@ -100,7 +100,8 @@ class Planet < PhysCube
private def calculate_gravity_vector(obj)
dir_vec = self.pos - obj.pos + Vector[self.width/2, self.height/2]
return (self.gravity * dir_vec)/(dir_vec.magnitude)
return dir_vec * self.gravity
# return (self.gravity * dir_vec)/(dir_vec.magnitude)
end
def orbit(physobjs)