Preventing vehicles from ever sliding

So basically my problem is that regardless of what I set in the vehiclescript, the car will slide at some point. May it be in curves or after a collision.
I just want the car to be as steady and stable as possible.

Which settings or maybe setting ratios do I need to look out for?

Thanks in advance!
lolomatrofl

So, I’ve found out that lowering the mass fixes this particular problem. However with lower mass, vibrations and tilting/shaking in the curve increases.
How to fix that?

Vehicle scripts are tricky. The best advice I can give you is to look at the default buggy and the default airboat vehiclescripts before you start tampering with others. A lot of those parameters can easily screw up the entire handling of the vehicle.

“Body” { “AddGravity” ****
“Body” { “MaxAngularVelocity” ***
“Body” { “CounterTorqueFactor” ****
“Body” { “MassOverride” ******

All are very important to keeping realistic handling with vehicles.

Ive been trying to start off with the buggy, then try to adjust things step by step. I’ve also tested out already existing vehiclescripts and tried to characterize them and get their distinguishing changes. No avail so far. While it’s to some degree unclear what certain settings do precisely, I can’t possibly know what counteracts with what and if there are any ratios to keep in mind. There’s obviously people good at this, I couldn’t find any explanatory resource. I’ve tried to play around with all of the above values actually, with mixed results, since I think they all counter-depend on other stuff.
I’ve actually literally hit a dead end at some point, since apparently a person who was particularly skilled at this seems to have passed away according to his profile comments.

Issues I always run into at some point (trying to name possible factors I’ve found here):
-Vehicle too slow (If wheel damping is set to certain ranges)
-Vehicle vibrates too heavily (Depends on vehicle mass and horse power)
-Vehicle’s suspension tilts too heavily while steering (this itself is also what I’d like to avoid or minimize, seems to be related to any kind of mass setting)
-Vehicle tilts back in an odd way after a curve, it seems uneven and kind of interrupting
-Vehicle too slippery (Seems to be related to mass and wheel mass, depending on booster or acceleration also caused by torque factor being too focused on the rear end)

I’m looking for some kind of kart racing movement, where the distinguishing skill factor in the mod would be how much items to collect and how to use them. Not particularly vehicles sliding after colliding with each other or trying to slide through a curve. Its absurd that something so straightforward is so difficult.

Also I’d like to note: Thank you for your reply. I tend to kind of feel lost with these issues at some point.

Perhaps this is of help, but you can kill an entity’s lateral velocity by using some vector math, I’m just not sure if this method works for vehicles, anyways, here’s something that may help.

I wrote this script but haven’t tested it.

Sorry in advance if it doesn’t work, but I know it can be done as I’ve done it before with players.

[lua]local Normal = Vehicle:GetRight()

local Velocity = Vehicle:GetVelocity()
local VelocityLength = Velocity:Length()

local Lateral = Normal:Dot( Velocity:GetNormalized() ) * Normal
local LateralLength = Lateral:Length()

local LateralVelocity = Normal * -LateralLength * 1

Vehicle:SetVelocity( Vehicle:GetVelocity() + LateralVelocity )[/lua]

The 1 in lateral velocity indicates the percentage that is applied ( 0-1 ) For example, if you were to set it to 0.5 you would get a little bit of skid, whereas if you use 1 you will get no skid at all.

Anyways, that script needs to be ran on a Think hook inside a loop to apply it to all vehicles, here’s an example

[lua]for k, Vehicle in pairs( Table to get Vehicles ) do

-- The code above would be adapted here.

end[/lua]

If you want to look more into this visit:

That script above is based off the tire’s “physics”

You can use SetupMove for this ( Vehicle movement is 100% server-side with no prediction so you shouldn’t have any negative side-effects from it [ If you have a model with physics on the client, but it doesn’t exist on the server, the vehicle will ride smoothly though it while a player walking will jitter ] ).

Just grab the player, if the player:GetVehicle( ) is valid and is a vehicle, then perform whatever…

nvm