fix: only apply friction if it's > 0

This commit is contained in:
Kazhnuz 2021-11-25 11:34:25 +01:00
parent f0819dd815
commit 9aa19dfa30

View file

@ -54,10 +54,16 @@ function PhysicalActor:getFuturePosition(dt)
end
function PhysicalActor:applyFriction(dt)
self.xsp = utils.math.toZero(self.xsp, self.xfrc * dt)
self.ysp = utils.math.toZero(self.ysp, self.yfrc * dt)
if (self.xfrc > 0) then
self.xsp = utils.math.toZero(self.xsp, self.xfrc * dt)
end
if (self.yfrc > 0) then
self.ysp = utils.math.toZero(self.ysp, self.yfrc * dt)
end
if (self.z ~= nil) then
self.zsp = utils.math.toZero(self.zsp, self.zfrc * dt)
if (self.zfrc > 0) then
self.zsp = utils.math.toZero(self.zsp, self.zfrc * dt)
end
end
end