Introduction
Hello Developers and Modelers, do you ever find the stud to be a confusing unit? And to all you using constraints, what units is spring stiffness and dampening in? What about mass, it means nothing because there is no provided conversion.
Well I also wondered those questions and found that this 16 year old game still has unconverted units.
Today I will make modeling and physics-tuning easier than ever by providing the conversions and proofs for every Roblox unit.
Conversions for those that don’t like reading, find it difficult to read, or who do not need proof.
3.571428571 studs = 1 meter
1 Roblox mass = 1 kg
21.952kg/studs^3 = 1 gram/cm^3
1 spring stiffness = 1 newton/meter
1 spring dampening = 1 newton/meter/second
3.571428571^2 (or 12.75510204) motor torque = 1 newton/meter
Doppler Scale = 0.28
Also check out my kit which converts studs to Imperial and Metric units, provides a physical mass and stiffness proof, and restates basically everything I said here.
“But wait a second these units are different!”
About a year after I made this post roblox published their own unit conversions to the site. Everything lines up well until we get to the mass and density section. The units the numbers provided for mass and density are swapped compared to mine. Mass and Length are two units where any conversion can be used, provided the rest of the conversions derived are consistent. My numbers appear to come out much cleaner than Roblox’s however, but it has the downside of a low density cap and unchangeable terrain water density.
Length
Studs to real units are going to be easy to prove but lets discuss other commonly used conversions first.
Note that you can use any unit you like for measurement but all the other conversions I will discuss later you will have to calculate differently.
-
1 stud = 1/20 of a meter, or 5 cm. Roblox’s default gravity is 196.2, using this conversion it works out to 9.81 meters/second^2. A character is 5 studs high which means its only 25cm high (The developers confirmed this in an old blog post, which has since been removed.)
-
1 stud = 1 foot. Gravity in this scenario is set to 32 feet/second^2, like real gravity.
A Roblox character is 5 feet tall in this scenario. Great choice because the units are easy to work with.
Well that blog post was published in 2012 and Roblox now has a realistic gravity mode. The change is that Roblox characters are now really close to a regular persons height in meters.
Lets provide the conversion.
Open studio and load up any place.
Click “FILE” in the top left corner.
Then click “Game Settings”.
Lastly click “World”.
When finish the steps the page should look like this:
On this page it provides a conversion from studs to meters. Lets use the gravity settings specifically to make an equation to find the conversion.
35 studs/second^2 = 9.8 meters/second^2
35/9.8 studs/meters = 0
3.571428571 studs / 1 meter or
3.571428571 studs is in 1 meter.
Type that in the gravity to see if you get 1 meter/second^2
Then remove the decimal place and type a bunch of zeros after it to test the accuracy.
Okay that’s pretty accurate. Re-entering those numbers back into the equation again does not give different results due to my calculator not having enough decimal places.
You can use any unit you like for measurement but some of the other conversions I will discuss later you will have to plug in your own stud to meter into the formula.
Mass
On this dev forum post there are many answers for what Roblox mass is each of them different from the other.
Even roblox’s own units post provides different results than what I derived. This is ok since any conversion can be used for mass just like length. I’ll walk through my process of deriving the conversion with two proofs. Notice how I had to make an assumption with both proofs which shows exactly why any unit can be used for mass as long as it is consistent with your other units.
I used the “mass = volume * density” equation to originally prove my point but it was way too complicated to be understandable. I also made an assumption in there so I tried proofing it with another equation.
Another equation for finding the mass of an object is “Mass = Force * Acceleration”.
I needed some way to apply a force to a part. Roblox provides vector forces which apply an acceleration based on how heavy the object it is pushing is. Perfect.
A typical unit for force is a newton, it defines how fast it can accelerate a mass. 1 newton can accelerate 1 kg at 1 meter/second^2. 9.8 newtons can move 1kg at 9.8 meters/second^2 and counteract gravity.
Therefore we need a force the exact opposite as the game gravity to determine mass.
We convert 9.8 newtons, aka kg/meters/s^2 to kg/studs/second^2 by multiplying by 3.571428571 to get 35 kg/studs/second^2 or 35 Newton-studs as I like to call it. This proves out units will be in Kg too.
Force = Mass * Acceleration
F = MA
35 = M35
35/35 = M
M = 1
Roblox mass is equivalent to real life Kg.
1 Kg = 1 Roblox mass.
Here is the overly-complicated proof for those interested:
Alright time to prove mass, a one stud block in Roblox with a density of 1 has a mass of 1. Also blocks with a density of 1 float on Roblox water. Cool, water has a density of 1 gram/cm^3, so Roblox must measure density in grams/cm^3 so now we can calculate mass. Unfortunately Roblox acts like density is measured in g/cm^3, but actually 1 stud cubed has a density of 1, not 1 cm cubed. This must mean that the unit mass/studs^3 is Roblox density and mass is unknown. Lets assume its kg and use kg/m^3 and convert it to kg/studs^3. Water has a density of 1000kg/m^3. We divide 1000 by (3.571428571)^3 or 45.55393586. Our new density for water is 21.952 kg/m^3. If we make a block in Roblox that is 3.571 studs long and has a density of 21.952, we get 999.64 mass, really close to 1000kg. Those small imperfections come from Roblox rounding the size of the cube to 3 decimal places.
Density
First of all density is a pretty useless measurement when it comes to making your game realistic. The density of a part only makes it float on terrain water and contributes to the mass of a part (which is important).
Secondly density is complicated to calculate, it might be hard to follow along
Before I calculated it however I made an educated guess. A part with a density of 1 floated on roblox water.
Water in grams/centimers^3 has a density of 1 too.
This sounds really logical, but now that we have our conversions we find that a part that weighs 1 gram and is a centimeter does not float on Roblox water (note that the mass is higher than 1 gram becuase we only got 2 decimal places to size the block).
Lets use the mass = volume * density formula to find out our density but first convert our volume units.
.01 meters^3, needs converted to studs^3
--conversion
.01 meter^3 (3.571428571 studs)^3
------------ * -----------------
1 1 meter^3
--crossed out and simplified
.01 45.55393586 studs^3
-------- * ----------------------
1 1
--removed denominator
.01 * 45.55393586 studs^3
--multiplied
.4555393586 studs^3 = volume
--Plug volume we just calculated into formula to get density
mass = volume * density
--substitute
.001kg = .4555393586 studs^3 * d
--simplify
21.952 kg/studs^3 = d
21.952 Roblox density is equal to 1gram/cm^3
We switched our grams to KGs to keep the units in line with our mass.
To calculate the density of any material look up its density in gram/cm^3 and multiply it by 21.952.
Because terrain water density cannot be changed, I had to create a workaround to get correctly sized and weighted parts to float. To make a part float on terrain water with the correct density, mass, and size; create a part with your density in g/cm^3 and weld 21 other parts inside it for a combined density multiplication of 22 which is about equal to 21.952.
Spring Stiffness/Dampening
Ok lets calculate spring stiffness. There is a periodic motion formula for springs that bounce up and down. If we know the max extension or compression of the spring and the force constantly pushing it down we can calculate spring stiffness.
The formula goes like this: Force = Stiffness * Extension. Lets put the stiffness on one side by rearranging. Force/Extension = Stiffness. We already know our conversions lets calculate.
(This is segments from a script I made that determines spring stiffness included in the model listed above. I’ll also provide the results in screenshot form.)
local spring = script.Parent.Top:WaitForChild("SpringConstraint")
local studtoMeter = 3.571428571 --How many studs are in a meter.
local Force = (((workspace.Gravity)/studtoMeter)*script.Parent.Top.Mass) --[[
This is the constant downwards force on the spring in Newton meters.
Newton meters are mass multiplied by gravity.
We convert in game gravity to meters and multiply it by the mass that we are
pushing.
Assuming our mass is still 1kg and the gravity 35 studs/second^2, we should
get 9.8.]]
print(Force)
length = {} --makes a table for us to store all our numbers
while true do
wait(.0667)
local sLength = spring.CurrentLength --Gets the length of the spring in studs
table.insert(length, sLength) --Inserts all spring lengths into table
table.sort(length,function(a,b) --Sorts by lowest and highest
if a > b then
return a
end
end)
local lLength = length[table.getn(length)] -- lowest number
local hLength = length[1] -- highest number
local amplitude = ((hLength-lLength)/studtoMeter) --[[We want the amplitude now.
We subtract the highest and lowest value to get the amplitude and convert to
meters to keep similar units with our force.]]
local stiffnessNm = Force/(amplitude/2) --[[The formula just calls for the
extension/compression length so dividng by 2 will give us that]]
print("Calculated spring stiffness is",stiffnessNm,"Newton/Meters. Original stifness is", spring.Stiffness)
end
I find it weird that spring stiffness wasnt in Newton/Studs. Slacking off there Roblox lol. The calculated stiffness was really close to the real one.
The only reason we didnt get a solid 100 for stiffness is not enough decimal places for the stud to meter conversion.
Roblox spring stiffness is in Newton/Meters.
Its a logical assumption to say that spring dampening is in Newton/Meter/Second, aka Ns/M, plus I have not made a proof yet because I have no clue how to.
Torque
The formula here is: Torque = Length x Force
The consistent units are Newton Meters(Torque), Meters(Length), and Newtons(Force). A Newton is Kg x Meter/Seconds^2, Kgs and Seconds are consistent in roblox units, but a meter is 3.571428571 studs.
The correct conversion should be 3.571428571 Roblox units of force.
A Newton Meter is simply Kg x Meters^2/Seconds^2, the conversion to meters is squared so (3.571428571)^2 or 12.75510204 Roblox Torque = 1 Newton Meter.
The torque test system is set up as follows: 12.755 roblox torque is paired to a lever that is 3.571 studs long with a force of 3.571 roblox force trying to turn the opposite direction.
The torque test confirms those theories, as the vector force (Force) does not overpower the hinge constraint(Torque) or vise versa.
Therefore 12.75510204 roblox torque = 1 newton meter.
Doppler Scale
This section is currently outdated. Roblox has changed how doppler scale works
I bet you did not know roblox had the doppler effect built into it! I did not know either until I accidentally clicked on SoundService in studio. SoundService provides us with three fun values to play with: “DistanceFactor, DopplerScale, and RolloffScale”. The most important of the three is DopplerScale which adjusts the pitch shift of moving sound sources relative to your camera. Roblox sets the default DopplerScale to 3.33. Roblox uses FMod for their sound system. According to FMod the scale is based off how many units per meter your game uses. https://www.fmod.com/docs/2.02/api/core-api-system.html#system_set3dsettings
If that is the case the DopplerScale should be set to 3.571 as there is 3.571 studs per meter. I tested this new value by spawning a part with a known pitch sound moving at a known speed, however I did not get much pitch shift.
I then inverted 3.571 to 0.28 and tested again. This time the pitch shift was within range. The best part is that when I set the part speed to the speed of sound (340m/s) the sound glitched out, but right below that value the sound did not bug out. With these new numbers it means the default speed of sound is about 1432m/s (going off math from a year ago that I did not check) which explains why nobody knew roblox had a doppler effect.
DopplerScale = 0.28 = 340m/s = 1214.28studs/s
Thanks for reading my first dev forum post! I really hope this helps lots of developers to take their games to the next level and clears up confusion about any Roblox units. Hopefully the next games that want to be realistic now will no longer feel like typical Roblox and will wow their players on how their game mechanics feel like real life.
If you find any errors in my conversions please let me know! It would benefit the entire community to have the correct units widely available!