Add limit to bouyancy

This commit is contained in:
ElCeejo 2022-07-21 16:00:26 -07:00
parent 738be4d003
commit fc6a203da2

View file

@ -935,9 +935,11 @@ local function water_physics(self)
local submergence = surface_pos.y - floor_pos.y local submergence = surface_pos.y - floor_pos.y
local vel = self.object:get_velocity() local vel = self.object:get_velocity()
local bouyancy = self.bouyancy_multiplier or 1 local bouyancy = self.bouyancy_multiplier or 1
local accel = (submergence - vel.y * abs(vel.y) * 0.4) * bouyancy
if accel > 4.9 then accel = 4.9 end
self.object:set_acceleration({ self.object:set_acceleration({
x = 0, x = 0,
y = (submergence - vel.y * abs(vel.y) * 0.4) * bouyancy, y = accel,
z = 0 z = 0
}) })
local hydrodynamics = self.hydrodynamics_multiplier or 0.7 local hydrodynamics = self.hydrodynamics_multiplier or 0.7