This commit is contained in:
Никита Круглицкий 2025-05-11 08:57:17 +06:00
parent baa8ffd07a
commit e441999c17
3 changed files with 15 additions and 9 deletions

View File

@ -39,7 +39,9 @@ local FrontWheelsConfig = table.merge(
{
SteerLock = 33,
CustomWheel = {
CasterAngle = 3
CasterAngle = 3,
CamberAngle = -3,
ToeAngle = 0.5
}
}
)
@ -47,7 +49,11 @@ local FrontWheelsConfig = table.merge(
local RearWheelsConfig = table.merge(
table.copy(WheelConfig),
{
HandbrakePower = 2200
HandbrakePower = 2200,
CustomWheel = {
CamberAngle = -1,
ToeAngle = 0.5
}
}
)
@ -113,13 +119,13 @@ Vehicle:new({
Name = 'WheelFL',
Type = POWERTRAIN_COMPONENT.Wheel,
Input = 'AxleFront',
Config = table.merge(table.copy(FrontWheelsConfig), { Offset = 0, CustomWheel = { CamberAngle = -3, ToeAngle = 0.5 } })
Config = table.merge(table.copy(FrontWheelsConfig), { Offset = 0 })
},
{
Name = 'WheelFR',
Type = POWERTRAIN_COMPONENT.Wheel,
Input = 'AxleFront',
Config = table.merge(table.copy(FrontWheelsConfig), { Offset = 180, CustomWheel = { CamberAngle = -3, ToeAngle = 0.5 } })
Config = table.merge(table.copy(FrontWheelsConfig), { Offset = 180 })
},
{
Name = 'AxleBack',
@ -155,12 +161,12 @@ Vehicle:new({
Name = 'WheelRL',
Input = 'AxleBack',
Type = POWERTRAIN_COMPONENT.Wheel,
Config = table.merge(table.copy(RearWheelsConfig), { Offset = 0, CustomWheel = { CamberAngle = -1, ToeAngle = 0.5 } })
Config = table.merge(table.copy(RearWheelsConfig), { Offset = 0 })
},
{
Name = 'WheelRR',
Input = 'AxleBack',
Type = POWERTRAIN_COMPONENT.Wheel,
Config = table.merge(table.copy(RearWheelsConfig), { Offset = 180, CustomWheel = { CamberAngle = -1, ToeAngle = 0.5 } })
Config = table.merge(table.copy(RearWheelsConfig), { Offset = 180 })
}
})

View File

@ -21,7 +21,6 @@ function Wheel:initialize(vehicle, name, config)
local font = render.createFont("Roboto", 256, 400, true)
local mat = render.createMaterial('models/debug/debugwhite')
hook.add("PostDrawTranslucentRenderables", "DEBUG_RENDER_" .. self.name, function()
if next(self.DEBUG_DATA) == nil then return end
if not isValid(self.DEBUG_DATA.entity) then return end
@ -67,7 +66,7 @@ function Wheel:initialize(vehicle, name, config)
self.holo = self:createHolo(self.entity)
self.customWheel = CustomWheel:new(config.CustomWheel)
self.customWheel = CustomWheel:new(table.merge(table.copy(config.CustomWheel), { Direction = self.direction }))
hook.add('input', 'vehicle_wheel_update' .. self.name, function(name, value)
if name == self.name then

View File

@ -12,6 +12,7 @@ local Wheel = class('Wheel')
function Wheel:initialize(config)
config = config or {}
self.direction = config.Direction or 1
self.mass = config.Mass or 20
self.radius = config.Radius or 0.27
self.rollingResistance = config.RollingResistance or 20
@ -19,7 +20,7 @@ function Wheel:initialize(config)
self.slipCircleShape = config.SlipCircleShape or 1.05
self.casterAngle = math.rad(config.CasterAngle or 0)
self.camberAngle = math.rad(config.CamberAngle or 0)
self.toeAngle = math.rad(config.ToeAngle or 0)
self.toeAngle = math.rad(config.ToeAngle or 0) * -self.direction
self.forwardFriction = Friction:new(config.ForwardFriction)
self.sideFriction = Friction:new(config.SideFriction)