Idk if this is in the right category.
Hello. At some point in roblox development, you have probably tried making a vehicle chassis. And if you have spent any reasonable time tuning your cars, you might notice how hard it is to tune the car suspension, or how long you can spend tweaking values, play testing, tweaking values, and playtesting. Or you might be a perfectionist like me. Where you tune your car really well, and then you either notice something really tiny, and minor that no one else will notice, or you might be wondering if you can tune your car even better, or go even farther, or you might not know if your car is even tuned correctly.
Well… in this topic, I will have (hopefully) saved you from countless hours of playtesting, tweaking, and not being satisfied with how well your car is tuned.
If you have ever made a car system, you might notice how ‘stiff’ your suspension is, or how it might feel like your car doesn’t even have suspension at all even though your car has spring constraints.
Here is a video of what I mean:
Ok, that video might have been a bad example, but I think you probably get the point. You have spring constraints, but they aren’t very soft, they are very ‘tough’, and it almost feels like there are no springs at all.
Here is a video of what the car suspension should feel like:
Maybe the springs on that car still seem a little ‘stiff’, but they are noticeably softer than the video with the other springs.
So. If you’ve ever made a car chassis, you’ve probably just set your spring stiffness, and damping to something random like 10k, and 500, and just left it as is. And that is probably why your car’s suspension feels ‘tough’, and not soft.
We will be taking a look at the critical damping formula/equation to figure out the right damping values for our springs
(2 * math.sqrt(mass * stiffness) * TuningConstant) / Wheel_Count, but I couldn’t find any good formula to tune the stiffness, so I will just be using
(mass * gravity) / Desired_Suspension_Height / Wheel_Count to figure out the ideal stiffness. I randomly came up with this, and it works really well for me and so that is why I will be using it.
(I know that Wikipedia exists, but it is way too hard to understand)
How to figure out the car's mass, and gravity.
If your car is like mine, and the mass depends on the mass of just one block, all you really need to do is select the part, and go to properties, and then find the mass property. If you can’t find this property, then reference the part in a line of code, and then call
:GetMass() and then print it. In my case
print(workspace.DefaultDuneBuggy.Chassis.Mass:GetMass(). And then run it in the command line/command bar. And it will print the mass of the car in the output.
If all of the parts of your car have mass, you need to loop through each BasePart (Meshes, Unions, Parts, Wedges, etc…) in the car, and add all of their masses together.
local mass = 0 for index, instance in pairs(Car_Reference:GetDescendants()) do if instance:IsA("BasePart") then mass = mass + instance:GetMass() end end print(mass)
Run this in the command bar (make sure to replace
Car_Refrence with the reference to your car), and then it will print the total mass of your vehicle.
To figure out gravity, then just go to workspace, and then find the gravity property. If you can’t find this property, then just run
print(workspace.Gravity) in the command line, and it will print the gravity in the game into the output.
My car’s mass is
3200, the gravity in the game is
196.2, and the amount of wheels my car has is
Now to figure out the stiffness, we can first multiply the mass (
3200) by the gravity (
196.2). We get the number (
627840). Next, we divide this by the desired suspension height. The desired suspension height is the desired distance from the center of the wheel that you want your car to be at on a perfectly flat surface. So, on my car, I want each corner of my chassis to be at least 3 studs away from the center of the wheel associated with that corner. (So the Back Left corner of the car should be at least 3 studs higher than the center of the back left tire/wheel, etc…)
So We divide this number (
3. This gives us
209280. Next, I have 4 wheels on my car, so I should divide this number (
4, this gives us
52320. This is roughly what the ideal stiffness of our springs should be.
Next, we need to figure out the ideal damping for our car.
First, we take our car’s mass which is (
3200), and then we multiply it by the stiffness of our springs which is (
52320). This gives us quite a large number (
167424000). Now we need to get the square root of this number (
167424000), which gives us (
12939.2426363). Next we need to multiply this number (
2. This now gives us (
We now have to deal with something called the damping, or tuning constant. Basically what this number does is it determines how much our car should bounce when we hit a bump, or when we are on really rough / bumpy terrain. If you really don’t care about this number, or want the car to ‘be little bouncy as possible’, just go ahead and set it to
1. But if you care about this number or something, then here is a tiny guide to the range of numbers you should set it too. For every day vehicles (Like sedans or regular civilian vehicles that you drive from home to work, and back almost every day), set this number to anywhere from
0.6, for off roaders where you don’t care about stability at high speeds, you just want to have fun in the mountains or something like that, you could set it to anywhere from
0.6. For sports cars where you want to have as much stability as possible at high speeds, and you don’t want to go flying off the track or road or loosing control if you hit a bump, you want to set this to anywhere from
Ok. Now. I’m going to set this number to
0.75 for my car, but you can set this to whatever you want. If we multiply our number (
25878.4852726) by our tuning/damping constant
0.75 we will get the number
19408.8639545. All we have left to do is divide our number (
19408.8639545) by the amount of wheels on our car. In my case my car has
4 wheels, so I will divide this number (
4. We now have
And there you go! You now (hopefully) have the ideal stiffness and damping for your vehicle.
If you are having any more issues, try making the stiffness not divide by 4. So just (
mass * gravity), and then re-configure the spring damping.
Also, try setting your wheels to massless (If this gives you any issues, feel free to revert them back to not massless).
If your car is also too bouncy, feel free to re-configure the damping, and then set the ‘magic’ constant to
1, and reconfigure the damping.
Also, when I refer to the ‘stability of a vehicle’, I’m referring to how much control you have of the vehicle at high speeds. If a car has really good stability, then you will have very little under steer, very little over steer, your car wont bounce excessively or go flying after hitting a bump at like
150+ miles per hour, and you won’t loose control and spin out from hitting a bump at that speed.
I was also a bit tired while editing my post, so if you find something weird, or I didn’t say something correctly, please feel free to correct me, or tell me so I can fix it.
Anyway. If you have any suggestions on how I could improve this, or want to contribute to this topic, please feel free to let me know, or reply.