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,11 +54,17 @@ function PhysicalActor:getFuturePosition(dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
function PhysicalActor:applyFriction(dt)
|
function PhysicalActor:applyFriction(dt)
|
||||||
|
if (self.xfrc > 0) then
|
||||||
self.xsp = utils.math.toZero(self.xsp, self.xfrc * dt)
|
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)
|
self.ysp = utils.math.toZero(self.ysp, self.yfrc * dt)
|
||||||
|
end
|
||||||
if (self.z ~= nil) then
|
if (self.z ~= nil) then
|
||||||
|
if (self.zfrc > 0) then
|
||||||
self.zsp = utils.math.toZero(self.zsp, self.zfrc * dt)
|
self.zsp = utils.math.toZero(self.zsp, self.zfrc * dt)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function PhysicalActor:solveAllCollisions(cols)
|
function PhysicalActor:solveAllCollisions(cols)
|
||||||
|
|
Loading…
Reference in a new issue