Make PhysicsManager use Map#gravity, defined EARTH and MOON gravity's

This commit is contained in:
2019-09-27 14:41:50 -05:00
parent f3d3ceebb8
commit 4af7f21a51
3 changed files with 4 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ class IMICFPS
MODEL_METER_SCALE = 1.0 MODEL_METER_SCALE = 1.0
# Earth # Earth
GRAVITY = 9.8 # m/s EARTH_GRAVITY = 9.8 # m/s
# Moon # Moon
# GRAVITY = 1.625 # m/s MOON_GRAVITY = 1.625 # m/s
end end

View File

@@ -31,7 +31,7 @@ class IMICFPS
if on_ground if on_ground
entity.velocity.y = 0 entity.velocity.y = 0
else else
entity.velocity.y -= IMICFPS::GRAVITY * entity.delta_time if entity.physics entity.velocity.y -= @collision_manager.map.gravity * entity.delta_time if entity.physics
end end
end end
end end

View File

@@ -5,7 +5,7 @@ class IMICFPS
attr_reader :collision_manager attr_reader :collision_manager
attr_reader :gravity attr_reader :gravity
def initialize(map_loader:, gravity: IMICFPS::GRAVITY) def initialize(map_loader:, gravity: IMICFPS::EARTH_GRAVITY)
@map_loader = map_loader @map_loader = map_loader
@gravity = gravity @gravity = gravity