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,11 +54,17 @@ function PhysicalActor:getFuturePosition(dt)
end
function PhysicalActor:applyFriction(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
if (self.zfrc > 0) then
self.zsp = utils.math.toZero(self.zsp, self.zfrc * dt)
end
end
end
function PhysicalActor:solveAllCollisions(cols)