Skip to content

Commit

Permalink
Add CounterSteer NW variable
Browse files Browse the repository at this point in the history
  • Loading branch information
StyledStrike committed Dec 19, 2024
1 parent fd6ac87 commit 8d6030e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/entities/base_glide_car/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function ENT:OnPostInitialize()
self:SetSteerConeChangeRate( 8 )
self:SetSteerConeMaxSpeed( 1800 )
self:SetSteerConeMaxAngle( 0.25 )
self:SetCounterSteer( 0.1 )

-- Update wheel parameters next tick
self.shouldUpdateWheelParams = true
Expand Down Expand Up @@ -436,7 +437,7 @@ function ENT:UpdateSteering( dt )
-- Counter-steer when slipping, going fast and not using steer input
local counterSteer = sideSlip * steerConeFactor * ( 1 - absInputSteer )

counterSteer = Clamp( counterSteer, -0.5, 0.5 )
counterSteer = Clamp( counterSteer, -1, 1 ) * self:GetCounterSteer()
inputSteer = Clamp( inputSteer + counterSteer, -1, 1 )

self.steerAngle[2] = -inputSteer * self:GetMaxSteerAngle()
Expand Down
1 change: 1 addition & 0 deletions lua/entities/base_glide_car/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function ENT:SetupDataTables()
AddFloatVar( "SteerConeChangeRate", 2, 20, "#glide.editvar.steering" )
AddFloatVar( "SteerConeMaxSpeed", 100, 5000, "#glide.editvar.steering" )
AddFloatVar( "SteerConeMaxAngle", 0.05, 0.9, "#glide.editvar.steering" )
AddFloatVar( "CounterSteer", 0, 1, "#glide.editvar.steering" )

-- Fake engine parameters
AddBoolVar( "TurboCharged", "#glide.editvar.engine" )
Expand Down
2 changes: 2 additions & 0 deletions lua/entities/base_glide_motorcycle/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ function ENT:OnPostInitialize()
self.reverseInput = 0

-- Change steering parameters to better suit bikes
self:SetMaxSteerAngle( 30 )
self:SetSteerConeChangeRate( 10 )
self:SetSteerConeMaxSpeed( 1200 )
self:SetSteerConeMaxAngle( 0.15 )
self:SetCounterSteer( 0.5 )
self:SetPowerDistribution( -1 )

-- Change traction parameters to better suit bikes
Expand Down
1 change: 1 addition & 0 deletions lua/entities/gtav_wolfsbane.lua
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ if SERVER then
self:SetDifferentialRatio( 1.8 )
self:SetBrakePower( 2000 )
self:SetWheelInertia( 9 )
self:SetMaxSteerAngle( 25 )
self:SetTractionBias( -0.35 )

self:SetMaxRPM( 15000 )
Expand Down

0 comments on commit 8d6030e

Please sign in to comment.