fix: only apply friction if it's > 0
This commit is contained in:
parent
f0819dd815
commit
9aa19dfa30
1 changed files with 9 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue