Probably fixed torque problem with diffs

This commit is contained in:
Ivan Grachyov 2021-11-13 02:10:34 +05:00
parent ac8458de72
commit 675bc6bf44

View File

@ -76,19 +76,19 @@ function Differential:update()
local usePower = self.gearbox and self.gearbox.torque > self.usePowerBias or false local usePower = self.gearbox and self.gearbox.torque > self.usePowerBias or false
local usedCoeff = usePower and self.power or self.coast local usedCoeff = usePower and self.power or self.coast
local lwPowerCoeff = usedCoeff local lwPowerCoeff = 1 -- usedCoeff
local rwPowerCoeff = usedCoeff local rwPowerCoeff = 1 -- usedCoeff
-- this could probably be shortened? -- this could probably be shortened?
-- if lwtq - rwtq > self.preload then if lwtq - rwtq > self.preload then
-- lwPowerCoeff = usedCoeff lwPowerCoeff = 1 + (1 - usedCoeff)
-- rwPowerCoeff = usedCoeff rwPowerCoeff = usedCoeff
-- end end
-- if rwtq - lwtq > self.preload then if rwtq - lwtq > self.preload then
-- lwPowerCoeff = usedCoeff lwPowerCoeff = usedCoeff
-- rwPowerCoeff = usedCoeff rwPowerCoeff = 1 + (1 - usedCoeff)
-- end end
local lwCorrectingTorque = math.clamp(lwDampingTorque * lwPowerCoeff, -self.maxCorrectingTorque, local lwCorrectingTorque = math.clamp(lwDampingTorque * lwPowerCoeff, -self.maxCorrectingTorque,
self.maxCorrectingTorque) self.maxCorrectingTorque)