Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

RotVelocity to get Rotations Per Second?

Lets say I have a wheel and I want to get its rotations per second. I'm not experienced enough to use the wheel's RotVelocity relative to the object to get its rotations per second. I plan on making realistic vehicles in my upcoming game that features an elaborate sound code for the engine sounds. Accessing the vehicles' RPS is crucial to the script. I'm not looking for an entire script. Just a fragment of code that would help me with my development. Much appreciated.

1 answer

✓ Accepted answer

By taking the Magnitude of the RotVelocity (which is measured in Radians), you get the angular frequency, or "w" (Greek symbol 'omega').

Then use the formula:

w = 2 * pi * f

(in English)

angular frequency = 2 * pi * ordinary frequency

So, in Lua that'd be:

rotationsPerSecond = part.RotVelocity.Magnitude / (2*math.pi)
--Rotations per second is known as "ordinary frequency" in this case

1 comment

0

Sounds good! I see how that works now. Thank you

This discussion is preserved as it was. New answers, comments, and votes are closed.