So I’ve been working on my chassis for the past week, experimenting with unsprung mass, and now I’ve moved onto realistically simulating suspension and I feel like I have my chassis, in terms of constraints and physics, in a valid state.

However, now comes the part that involves a lot of calculations: transmission, rpm etc.

I read a post here about vehicles (I specifically read the solution) and right at the very bottom of the solution, Wunder_Wulfe mentions:

So I’ve read online that, to calculate RPM of a wheel, I get the speed of the vehicle and divide it by the circumference of the wheel. However, here Wunder_Wulfe mentions that the “better” way is by “checking slowest and fastest spinning wheel”.

Could anyone provide an explanation as to what he means by this? What would I do with such information? How would this tie into calculating the RPM?

Any help is appreciated!

Thanks, DaR3ka

2 Likes

So I take it this would have something to do with gear ratios?
The car I’m simulating is a Mazda RX-7 and I found some sort of site to do with gear ratios here.

Do you by chance have any sort of idea/knowledge of what I’d do with these ratios to calculate RPM or are they unlinked?

I found this article on Quora and it seems helpful, so I’ll do some digging and see what I can figure out for myself!

I appreciate the reply too, you put things in a different perspective for me. I was beginning to worry my post would never be seen or replied to- guess I’m too impatient lol

Just finished re-reading and this is beginning to make a lot more sense to me now, thanks a bumch for the reply. From what you’ve said here I’m fairly certain I should be able to do all the calculations for now.

Thanks a bunch for the help!

(Side note: if anyone wants to add more, feel free, I’ll still be keeping an eye on the thread)

3 Likes

The way I worded it is a little confusing, but it should provide a decent simulated way to calculate rpms.

Within your code, you could have the car’s gear change whenever its speed falls into 1 of those categories (ignoring neutral and reverse right now).

example: car speed = 5 mph --> set gear to 1st gear

–> then calculate rpm based on the selected gear

1 Like

In actuality, RPM is based on the wheels that are powered by the engine. Much like how you could derive wheel torque and RPM from the engine, you can do the opposite and reverse the process (you would need a clutch or torque converter when the wheel is idling to prevent engine stalls, (0 RPM)) and gears would divide the gear ratio because higher gear ratios mean more torque is gained in turn for less speed. You would also need to account for things like Final Drive (or the wheel differential ratio). This of course is the more complex and accurate way of simulating a vehicle, in accordance with vehicle engineering and the topic someone else replied with.

To get the rpm accurately regardless of what orientation the axis that the wheel is spinning on, use RotVelocity.Magnitude in your scripts

Incorrect as the wheel RPM is based specifically on the axis of rotation. `RotVelocity:Dot(spinAxis)` where `spinAxis` is the axis the wheel rotates around, i.e. the RightVector for all Cylinders. Not only does this get the direction the wheel is spinning in (forward / backward) but it also its more accurate, not taking into account the rotation of the wheel if the vehicle was say, spinning out.
Also, that is not the RPM (Revolutions Per Minute) it is actually the rad / s (Radians Per Second), so you would need to use unit conversions to convert. One full revolution is `2π`, so `X rad/s / 2π = X RPS` and if this is how long it takes for one second, you need how long it would be for a minute (60s), so `X RPS * 60 = X RPM`, the final conversion being `X * 30/π` after simplification. Also don’t forget that the RPM of the wheel is not the same as that of the engine.

You could also use tangential velocity if you want to do stuff like make all wheels rotate at differing speeds, but move at the same speed. That equation is `vel = radius * rad/s`, so to solve for `rad/s` for the `AngularVelocity` property, you could use basic algebra and get `vel / radius = rad/s` with `vel` being the target velocity for the wheel, and `radius` being the diameter of the wheel (from .Size property) divided by 2. I suggest working with these values rather than RPM directly, as this gives you much simpler control over the speed of the vehicle without worrying about things like differential ratios.

2 Likes
`````` Very nice explanation, I have also discovered something that could be considered important. According to what I've observed, if you multiply the Rotvelocity number by 10 you get the actual RPM in real life. How did I figure this out?
It may sound strange but I have calculated this by using my washing machine (which can display the rpm of the drum if you press certain buttons) and a spinning part with a clicker that clicks once every revolution. The part with a RotVelocity of 50 was spinning the same speed as the washer spinbasket when it was spinning 500 rpm. The same thing occured when the machine was spinning at 800 and 950 rpm which suggest the relationship in rpm to be linear. Every rpm of a real life object I have compared to my testing model, the ratio was the same; the actual rpm was 10x the RotVelocity``````

Very nice explanation, I have also discovered something that could be considered important. According to what I’ve observed, if you multiply the Rotvelocity number by 10 you get the actual RPM in real life. How did I figure this out?
It may sound strange but I have calculated this by using my washing machine (which can display the rpm of the drum if you press certain buttons) and a spinning part with a clicker that clicks once every revolution. The part with a RotVelocity of 50 was spinning the same speed as the washer spinbasket when it was spinning 500 rpm. The same thing occured when the machine was spinning at 800 and 950 rpm which suggest the relationship in rpm to be linear. Every rpm of a real life object I have compared to my testing model, the ratio was the same; the actual rpm was 10x the RotVelocity

what…? No, it is not actually 10. it is `60 / 2π (aka 30 / π)`, do you know what `π` is? `3.14......` and `30 / 3` is `10`, but you are not supposed to round `π` in equations. I showed the calculations above, make sure to read through them to understand. Also, of course the relationship is linear. RotVelocity is in `radians per second`, so `revolutions per minute` is just a simple unit conversion that represents the same exact value. It is still `rotation_type / time_type`.

1 Like

But yet at 50 RotVelocity the part is spinning at 500 rpm,10 RotVelocity is spinning at 100 Rpm, the relationship is linear. I literally timed it with sound and visuals. Every click is 1 rpm and the rotation speed matches by x10. I figured this out because my washing machine can display the rpm on its screen. No need for complex math here. It is a simple comparison using the senses that has proven accurate for me time and time again

Im gonna use this way, but do I need to calculate RPM in a while loop? On client? On Server?

Multiply the RotVelocity.Magnitude of the part x10 to get the actual rpm that the part is spinning at. Not Rotvelocity.X, Y, or Z, because they depend on the vector of which the part is orientated to calculate a number. For straight RPM no matter which direction the part is facing multiply the RotVelocity.Magnitude of the part x10

Besides, again, wheels always rotate around their axes. Wheels rotate on a hinge, and that hinge only spins in one direction. So you need to use `RotVelocity:Dot(spinAxis)` to get the correct rotation direction and amount. This not only allows you to get whether or not a wheel is spinning forward or backward, but also how much it is spinning in the only axis that actually matters. Also, again, `30 / π` is `9.5492965855...` which may be close to 10, but it is not the same thing. Accurate calculations should use this ratio instead. Your calculations were probably inaccurate / estimates of the actual values. I recommend learning about dot products and some rotation conversion calculations.
Rotational Quantities and Radian per second - Wikipedia are good starts.

(the 60/(2π) aka 30/π already mentioned to verify). It is not complicated math, but it is pretty useful.

``````local ratio: number = 30 / math.pi

local angularVelocity: number =
cylinder.RotVelocity:Dot(
cylinder.CFrame.RightVector --or you can use the WorldAxis for the attachment
)

local wheelRPM: number = angularVelocity * ratio
local wheelVelocity: number = angularVelocity * wheelRadius --tangential velocity
``````

Some useful things to do with this information:
Weighted average of wheelVelocities:

``````local totalTorque: number = 0
local averagedVelocity: number = 0
for i, wheel in ipairs(myWheels) do
totalTorque += wheel.TorquePercent
averagedVelocity += wheel:TangentialVelocity() * wheel.TorquePercent --or base it off of wheelRPM
--this way might be easier because it works for wheels of all sizes and allows for easier speed limiting
end
if totalTorque > 0 then
averagedVelocity /= totalTorque --this would get the average wheel movement speed
--this is great because free-spinning wheels (0% of torque output) have no effect on this number
--and you can balance this value based on power output, so this works for FWD, RWD, and AWD cars
end
--then you can use this property in things such as pitch shifting
``````
4 Likes

you cant do heartbeat on server right

RunService Heartbeat does run on the Server Side, what made you think it didn’t?

oh wow, i thought runservice was all client side, but now i dont need some while loops on server, i dont know what made me think it wasnt able to be used on server

I believe you meant RenderStepped event of RunService, it is only useable in the client side.

no i really thought whole runservice was client only

You need to actually get the crankshaft speed which connects to the driveshaft and the driveshaft depends on car so you would get wheel speed/driveshaft*100+minimalRPM it sounds hard but once you get the hang of it it should be easy, if u still cant do it try using a-chassis and looking at how they calculate it, Good luck also i did *100 but if you want to be exact use *60