getUncapped
Definition
-- @/lua/common/filters.lua:363
function temporalSmoothing:getUncappedAutoCenter(sample, dt)
local st = self.state
local dif = (sample - st)
local rate
if sample == 0 then
rate = self.autoCenterRate -- autocentering
else
rate = self[dif * st >= 0]
end
st = st + dif * min(rate * dt / abs(dif), 1)
self.state = st
return st
end
Callers
@/lua/ge/extensions/core/cameraModes/relative.lua
local adjustedSpeed = data.fastSpeedModifier and data.speed * 3 or data.speed
local dtPosFactor = factorSmoother:getUncapped(adjustedSpeed / 80, data.dt)
local pd = dtPosFactor * data.dt * vec3(dx, dy, dz)
@/lua/vehicle/input.lua
local function updateGFX(dt)
gxSmoothMax = gx_Smoother:getUncapped(0, dt)
local absgx = abs(sensors.gx)
@/lua/vehicle/controller/drivingDynamics/sensors/sensorHub.lua
local accXNoiseUpper = accXNoiseUpperSmoother:getUncapped(max(M.accelerationX, 0), dt)
local accXNoiseLower = accXNoiseLowerSmoother:getUncapped(min(M.accelerationX, 0), dt)
local accXNoiseUpper = accXNoiseUpperSmoother:getUncapped(max(M.accelerationX, 0), dt)
local accXNoiseLower = accXNoiseLowerSmoother:getUncapped(min(M.accelerationX, 0), dt)
M.accNoiseX = min(abs(accXNoiseUpper - accXNoiseLower), 150)
local accYNoiseUpper = accYNoiseUpperSmoother:getUncapped(max(M.accelerationY, 0), dt)
local accYNoiseLower = accYNoiseLowerSmoother:getUncapped(min(M.accelerationY, 0), dt)
local accYNoiseUpper = accYNoiseUpperSmoother:getUncapped(max(M.accelerationY, 0), dt)
local accYNoiseLower = accYNoiseLowerSmoother:getUncapped(min(M.accelerationY, 0), dt)
M.accNoiseY = min(abs(accYNoiseUpper - accYNoiseLower), 150)
local accZNoiseUpper = accZNoiseUpperSmoother:getUncapped(max(M.accelerationZ - M.gravity, 0), dt)
local accZNoiseLower = accZNoiseLowerSmoother:getUncapped(min(M.accelerationZ - M.gravity, 0), dt)
local accZNoiseUpper = accZNoiseUpperSmoother:getUncapped(max(M.accelerationZ - M.gravity, 0), dt)
local accZNoiseLower = accZNoiseLowerSmoother:getUncapped(min(M.accelerationZ - M.gravity, 0), dt)
M.accNoiseZ = min(abs(accZNoiseUpper - accZNoiseLower), 150)
@/gameplay/missionTypes/hypermiling/fluidConsumptionToGraph.lua
local fuelConsumption = math.min(math.max((fuelData.fuel - fuelVolume) / (dt * electrics.values.wheelspeed) * 1000 * 100, 0), 100) -- l/100km
fuelConsumption = fuelData.gFuelSmoother:getUncapped(fuelConsumption, dt)
@/lua/vehicle/controller/drivingDynamics/supervisors/components/aeroControl.lua
electrics.values.yawControlRequestReduceOversteer = sign(reduceOversteerSmoother:getUncapped(requestReduceOversteer and 1 or 0, dt))
return M.isActingAsYC
@/lua/vehicle/controller/drivingDynamics/CMU.lua
local isRollingOver = M.sensorHub.pitch > 0.9 or M.sensorHub.roll > 0.9
local isOnRoofSmooth = isOnRoofSmoother:getUncapped(isOnRoof and 1 or 0, dt)
local isCrashed = electrics.values.postCrashBrakeTriggered and electrics.values.postCrashBrakeTriggered > 0
local isStopped = abs(M.sensorHub.accelerationXSmooth) < 2 and abs(M.sensorHub.accelerationYSmooth) < 2 and abs(M.sensorHub.yawAVSmooth) < 0.5
local isStoppedSmooth = isStoppedSmoother:getUncapped(isStopped and 1 or 0, dt)
@/lua/common/luaProfiler.lua
result.smFast = result.smFast or newTemporalSmoothing(fast)
local smTotalSlow = result.smSlow:getUncapped(value, dt)
local smTotalFast = result.smFast:getUncapped(value, dt)
local smTotalSlow = result.smSlow:getUncapped(value, dt)
local smTotalFast = result.smFast:getUncapped(value, dt)
result.unstableRel = math.abs(smTotalFast - smTotalSlow) / smTotalSlow
@/lua/vehicle/controller/gauges/customModules/combustionEngineData.lua
local fuelConsumption = clamp((previousFuel - fuelVolume) / (dt * wheelspeed) * 1000 * 100, 0, 50) -- l/100km
fuelConsumption = fuelSmoother:getUncapped(fuelConsumption, dt)
previousFuel = fuelVolume
end
moduleData.fuelDisplay = fuelDisplaySmoother:getUncapped(fuelDisplay, dt)
end
@/lua/vehicle/controller/esc.lua
v.throttleFactor = 1
v.allWheelSlip = v.allWheelSlipSmoother:getUncapped(0, dt)
end
--No slip here, let the next frame know that we have at least one good wheel
throttleFactorData[throttleFactorName].allWheelSlip = max(throttleFactorData[throttleFactorName].allWheelSlipSmoother:getUncapped(-1, dt), 0)
else
throttleFactorData[throttleFactorName].tcsActive = true
throttleFactorData[throttleFactorName].allWheelSlip = throttleFactorData[throttleFactorName].allWheelSlipSmoother:getUncapped(1, dt)
end
--calculate wheel speed correction factors for next frame (different wheel speeds because of turning
local refNodeAcc = lateralAccSmoother:getUncapped(abs(sensors.ffiSensors.sensorX), dt)
local turningCircleRef = (speed * speed) / refNodeAcc
@/lua/vehicle/recovery.lua
blendTime = blendTime + dtReal
local snapshotTime = snapshotTimeSmoother:getUncapped(0.08, dtReal)
while blendTime > snapshotTime do
@/lua/vehicle/powertrain/supercharger.lua
end
blowerPressure = pressureSmoother:getUncapped(blowerPressure, dt) --and get the final pressure
@/lua/ge/extensions/gameplay/util/crashDetection.lua
local accel = abs(point.smootherAcc:getUncapped(sqrt(square(tempVecCurrAccel.x) + square(tempVecCurrAccel.y) + square(tempVecCurrAccel.z)), dtSim))
@/lua/vehicle/powertrain/combustionEngine.lua
if device.slowIgnitionErrorActive then
device.slowIgnitionErrorCoef = device.slowIgnitionErrorSmoother:getUncapped(math.random(), dt)
end
local lowFuelIgnitionErrorChance = linearScale(device.remainingFuelRatio, 0.01, 0, 0, 0.4)
local fastIgnitionErrorCoef = device.fastIgnitionErrorSmoother:getUncapped(math.random(), dt)
device.fastIgnitionErrorCoef = fastIgnitionErrorCoef < (device.fastIgnitionErrorChance + lowFuelIgnitionErrorChance) and 0 or 1
device.idleAVReadError = device.idleAVReadErrorSmoother:getUncapped(device.idleAVReadErrorRangeHalf - random(device.idleAVReadErrorRange), dt) * device.wearIdleAVReadErrorRangeCoef * device.damageIdleAVReadErrorRangeCoef
device.idleAVStartOffset = device.idleAVStartOffsetSmoother:get(device.idleAV * device.idleStartCoef * device.starterEngagedCoef, dt)
--smooth our actual throttle value to simulate various effects in a real engine that do not allow immediate throttle changes
throttle = device.throttleSmoother:getUncapped(throttle, dt)
@/lua/vehicle/controller/propAnimation/sequentialLever.lua
local volume = impulseIsShiftOut and shiftSoundVolumeGearDown or shiftSoundVolumeGearUp
yCurrent = ySmoother:getUncapped(shiftImpulse, dt)
if shiftImpulse ~= previousShiftImpulse then
@/lua/vehicle/powertrain/electricMotor.lua
--smooth our actual throttle value to not have super instant torque that will just break traction
throttle = device.throttleSmoother:getUncapped(throttle, dt)
device.throttle = throttle
--smooth our actual throttle value to not have super instant torque that will just break traction
throttle = device.throttleSmoother:getUncapped(throttle, dt)
device.throttle = throttle
@/lua/vehicle/wheels.lua
local squealAVTorqueFadeOut = clamp(actualBrakeTorque * 0.05, 0, 1) * clamp((absAVBrakeCouple - 1), 0, 1) --only ever have any volume if both torque and av are > 0
brakeSquealVolume = (wd.brakeSquealVolumeSmoother:getUncapped(max(naturalSquealVolume, lowSpeedSquealVolume, glazingSquealVolume) * squealAVTorqueFadeOut, dt))
@/lua/vehicle/extensions/cruiseControl.lua
local output = speedPID:get(currentSpeed, rampedTargetSpeed, dt)
electrics.values.throttleOverride = throttleSmooth:getUncapped(output, dt)
@/lua/common/filters.lua
function temporalSmoothing:getCapped(sample, dt)
return max(min(self:getUncapped(sample, dt), 1), -1)
end
@/lua/vehicle/controller/drivingDynamics/sensors/virtualSensors.lua
M.virtual.wheelSpeed = avgNonPropulsedWheelSpeed / nonPropulsedWheelCount
trustWorthiness.wheelSpeed = smoother.wheelSpeedTrust:getUncapped(brakingTrustWorthinessNonPropulsed, dt)
else
M.virtual.wheelSpeed = avgWheelSpeed / wheels.wheelCount
trustWorthiness.wheelSpeed = smoother.wheelSpeedTrust:getUncapped(min(brakingTrustWorthiness, propulsionTrustWorthiness), dt)
end
resetCriteria.isRollingProbability = resetCriteria.isRollingProbabilitySmoother:getUncapped(rawIsRollingProbability, dt)
resetCriteria.isStoppedProbability = resetCriteria.isStoppedProbabilitySmoother:getUncapped(rawIsStoppedProbability, dt)
resetCriteria.isRollingProbability = resetCriteria.isRollingProbabilitySmoother:getUncapped(rawIsRollingProbability, dt)
resetCriteria.isStoppedProbability = resetCriteria.isStoppedProbabilitySmoother:getUncapped(rawIsStoppedProbability, dt)
resetCriteria.isDrivingStraightProbability = resetCriteria.isDrivingStraightProbabilitySmoother:getUncapped(rawIsDrivingStraight, dt)
resetCriteria.isStoppedProbability = resetCriteria.isStoppedProbabilitySmoother:getUncapped(rawIsStoppedProbability, dt)
resetCriteria.isDrivingStraightProbability = resetCriteria.isDrivingStraightProbabilitySmoother:getUncapped(rawIsDrivingStraight, dt)
@/lua/vehicle/controller/drivingDynamics/supervisors/components/motorTorqueControl.lua
local output = controlData.throttleFactorSmoother:getUncapped(1 - controlData.tractionControlPID:get(-wheelGroup.maxSlip, -controlData.slipThreshold, dt), dt)
output = max(output, controlData.minimumThrottleLimit)
@/lua/vehicle/controller/drivingDynamics/sensors/vehicleData.lua
end
local refNodeAcc = smoothers.turningCircleAcc:getUncapped(abs(CMU.sensorHub.accelerationXSmooth), dt)
local turningCircleAcc = (speed * speed) / refNodeAcc
@/lua/vehicle/extensions/escMeasurement.lua
local targetThrottle = max(max(min(error * 0.5 + ccIntegral * 0.02, 1), 0) - accError * 10, 0)
throttleOverride = ccThrottleSmoother:getUncapped(targetThrottle, dt)
ccHasReachedTargetSpeed = abs(error) / ccTargetSpeed <= 0.03
ccHasReachedTargetSpeed = true
throttleOverride = ccDisableSmoother:getUncapped(0, dt)
if throttleOverride == 0 then
local targetSteeringInput = maxSteerAngle ~= 0 and (currentTargetAngle / maxSteerAngle) or 0
local steeringInput = steeringSmoother:getUncapped(targetSteeringInput, dt)
local targetSteeringInput = targetSteeringAngle
local steeringInput = steeringSmoother:getUncapped(doSteer and targetSteeringInput or 0, dt)
@/lua/vehicle/powertrain/combustionEngineThermals.lua
end
radiatorFanRPM = electricalRadiatorFanSmoother:getUncapped(fanAirSpeed > 0 and 2500 or 0, dt)
elseif radiatorFanType == "mechanical" then
local oilpanAccXY = clamp(oilpanForceXY * invNodeWeight, -gravityLimit, gravityLimit)
oilpanAccZ = oilpanAccZSmoother:getUncapped(oilpanAccZ, dt)
oilpanAccXY = oilpanAccXYSmoother:getUncapped(oilpanAccXY, dt)
oilpanAccZ = oilpanAccZSmoother:getUncapped(oilpanAccZ, dt)
oilpanAccXY = oilpanAccXYSmoother:getUncapped(oilpanAccXY, dt)
oilStarvingSevernessZ = -oilpanAccZ -- use the more accurate oilpan Z acc rather than refnode acc if we have it
@/lua/vehicle/controller/etkGauges.lua
previousFuel = fuelVolume
local fuelConsumptionSmooth = fuelSmoother:getUncapped(fuelConsumption, updateTimer)
end
data.fuelDisplay = fuelDisplaySmoother:getUncapped(fuelDisplay, updateTimer)
@/lua/ge/extensions/scenario/busdriver.lua
local smAcc = smootherAcc:getUncapped(acc.x, dtSim) / abs(gravity)
local jerkMultiplier = 1/5000
if not smootherJer then smootherJer = newTemporalSmoothing(30000*jerkMultiplier, jerkMultiplier*5000000) end
local smJer = smootherJer:getUncapped(jer, dtSim)
if smJer > 2 then smootherJer:set(2) smJer = 2 end
@/lua/vehicle/controller/hydraulicSuspension.lua
local volume = releaseSoundVolumeSmoother:getUncapped(sqrt(avgBleedCoef), dt)
obj:setVolumePitch(releaseSoundLoop, volume, 1)
@/lua/vehicle/ai.lua
egoDeviationSmoother:set(outDeviation)
egoDeviationSmoother:getUncapped(0, dt)
@/lua/vehicle/controller/playerController.lua
local speedError = max(desiredMovementSpeed - actualSpeed, 0)
speedError = ballTorqueSmoother:getUncapped(speedError, dt)
@/lua/vehicle/powertrain/turbocharger.lua
local wastegateDerivative = (boostError - lastBoostError) / dt
wastegateFactor = bovEngaged and 0 or wastegateSmoother:getUncapped(clamp((1 - (boostError * wastegatePCoef + wastegateIntegral * wastegateICoef + wastegateDerivative * wastegateDCoef)), 0, 1), dt)
turboPressureRaw = assignedEngine.isStalled and 0 or ((turbo.turboPressureCurve[floor(turboRPM)] * constants.psiToPascal) or turboPressure)
turboPressure = pressureSmoother:getUncapped(turboPressureRaw, dt)
local notInRevLimiter = assignedEngine.revLimiterWasActiveTimer > 0.1
local ignitionNotCut = ignitionCutSmoother:getUncapped(assignedEngine.ignitionCutTime > 0 and 1 or 0, dt) <= 0
bovRequested = needsBov and (loadLow or highLoadDrop) and notInRevLimiter and ignitionNotCut
if bovEnabled then
turboPressure = pressureSmoother:getUncapped(0, dt)
end
@/lua/vehicle/controller/axleLift.lua
local rearPos = rearRaisedPosition
local velocity = velocitySmoother:getUncapped(min(electrics.values.wheelspeed or 0, velocityThresholdDisable + 2), dt)
if currentMode == modes.auto then
@/lua/vehicle/controller/drivingDynamics/supervisors/yawControl.lua
local function updateGFX(dt)
isActiveSmoothed = isActiveSmoother:getUncapped(yawControlActive and 1 or 0, dt)
M.isActing = isActiveSmoothed >= 1
@/lua/vehicle/sounds.lua
-- RIGID asphalt
local asphaltContactSmooth = wheelSound.asphaltContactSmoother:getUncapped(boolToNum[(mat == 10 or mat == 29) and wd.contactDepth == 0 and isRubberTire], dt)
if asphaltContactSmooth > maxContact then
-- RIGID asphalt wet
local asphaltwetContactSmooth = wheelSound.asphaltwetContactSmoother:getUncapped(boolToNum[mat == 11 and wd.contactDepth == 0 and isRubberTire], dt)
if asphaltwetContactSmooth > maxContact then
-- RIGID cobble stone
local cobbleStoneContactSmooth = wheelSound.cobbleStoneContactSmoother:getUncapped(boolToNum[mat == 30 and wd.contactDepth == 0 and isRubberTire], dt)
if cobbleStoneContactSmooth > maxContact then
-- RIGID ice
local iceContactSmooth = wheelSound.iceContactSmoother:getUncapped(boolToNum[mat == 21 and wd.contactDepth == 0 and isRubberTire], dt)
if iceContactSmooth > maxContact then
-- RIGID metal
local metalContactSmooth = wheelSound.metalContactSmoother:getUncapped(boolToNum[mat == 2 and wd.contactDepth == 0 and isRubberTire], dt)
if metalContactSmooth > maxContact then
-- RIGID wood
local woodContactSmooth = wheelSound.woodContactSmoother:getUncapped(boolToNum[mat == 6 and wd.contactDepth == 0 and isRubberTire], dt)
if woodContactSmooth > maxContact then
-- LOOSE dirt
local dirtContactSmooth = wheelSound.dirtContactSmoother:getUncapped(boolToNum[mat == 15 and isRubberTire], dt)
if dirtContactSmooth > maxContact then
-- LOOSE dirtDusty
local dirtdustyContactSmooth = wheelSound.dirtDustyContactSmoother:getUncapped(boolToNum[mat == 14 and isRubberTire], dt)
if dirtdustyContactSmooth > maxContact then
-- LOOSE grass
local grassContactSmooth = wheelSound.grassContactSmoother:getUncapped(boolToNum[mat == 20 and isRubberTire], dt)
if grassContactSmooth > maxContact then
-- LOOSE gravel
local gravelContactSmooth = wheelSound.gravelContactSmoother:getUncapped(boolToNum[mat == 19 and isRubberTire], dt)
if gravelContactSmooth > maxContact then
-- LOOSE mud
local mudContactSmooth = wheelSound.mudContactSmoother:getUncapped(boolToNum[mat == 18 and isRubberTire], dt)
if mudContactSmooth > maxContact then
-- LOOSE rock
local rockContactSmooth = wheelSound.rockContactSmoother:getUncapped(boolToNum[mat == 13 and isRubberTire], dt)
if rockContactSmooth > maxContact then
-- LOOSE sand
local sandContactSmooth = wheelSound.sandContactSmoother:getUncapped(boolToNum[mat == 16 and isRubberTire], dt)
if sandContactSmooth > maxContact then
looseSurfaceType = wheelSound.loosenessSmoother:getUncapped(looseSurfaceType, dt)
-- MISC rumblestrip
local rumbleStripContactSmooth = wheelSound.rumbleStripContactSmoother:getUncapped(boolToNum[mat == 29 and isRubberTire], dt)
if rumbleStripContactSmooth > 0 then
@/lua/ge/extensions/core/cameraModes/chase.lua
end
dir:set(self.dirSmoothX:getUncapped(dir.x, data.dt*1000), self.dirSmoothY:getUncapped(dir.y, data.dt*1000), self.dirSmoothZ:getUncapped(dir.z, data.dt*1000)); dir:normalize()
end
end
dir:set(self.dirSmoothX:getUncapped(dir.x, data.dt*1000), self.dirSmoothY:getUncapped(dir.y, data.dt*1000), self.dirSmoothZ:getUncapped(dir.z, data.dt*1000)); dir:normalize()
end
end
dir:set(self.dirSmoothX:getUncapped(dir.x, data.dt*1000), self.dirSmoothY:getUncapped(dir.y, data.dt*1000), self.dirSmoothZ:getUncapped(dir.z, data.dt*1000)); dir:normalize()
end
local velNF = vel:distance(velF * dir)
local forwardVelo = self.fwdVeloSmoother:getUncapped(velF, data.dt)
if self.camResetted == 0 then
@/lua/vehicle/controller/drivingDynamics/supervisors/tractionControl.lua
local function updateGFX(dt)
isActiveSmoothed = isActiveSmoother:getUncapped(tractionControlActive and 1 or 0, dt)
M.isActing = isActiveSmoothed >= 1
@/lua/vehicle/controller/propAnimation/singleAxisLever.lua
if targetPosition ~= currentPosition then
currentPosition = positionSmoother:getUncapped(targetPosition, dt)
if not hasPlayedSound then
@/lua/vehicle/controller/vehicleController/vehicleController.lua
end
local groundContactCoef = smoother.groundContactSmoother:getUncapped(hasGroundContact and 1 or 0, dt)
smoothedValues.throttle = smoother.throttle:getUncapped(M.throttle, dt)
smoothedValues.brake = smoother.brake:getUncapped(M.brake, dt)
smoothedValues.throttle = smoother.throttle:getUncapped(M.throttle, dt)
smoothedValues.brake = smoother.brake:getUncapped(M.brake, dt)
smoothedValues.throttleInput = smoother.throttleInput:getUncapped(inputValues.throttle, dt)
smoothedValues.brake = smoother.brake:getUncapped(M.brake, dt)
smoothedValues.throttleInput = smoother.throttleInput:getUncapped(inputValues.throttle, dt)
smoothedValues.brakeInput = smoother.brakeInput:getUncapped(inputValues.brake, dt)
smoothedValues.throttleInput = smoother.throttleInput:getUncapped(inputValues.throttle, dt)
smoothedValues.brakeInput = smoother.brakeInput:getUncapped(inputValues.brake, dt)
@/lua/vehicle/controller/braking/adaptiveBrakeLights.lua
local absActiveCoef = boolToNumber(electrics.values.absActive) or 0
local absActive = absActiveSmoother:getUncapped(absActiveCoef, dt)
local escActive = 0
end
escActive = escActiveSmoother:getUncapped(isESCActive, dt)
end