Hi.
This doesn’t pertain exactly to scripting support, but it’s the closest category I can find.
Simply, I want to mathematically prove different kinematic equations using ROBLOX physics.
Methodology
I’ve found that objects within a traditional workspace are treated as being in a vacuum, and hence exist in free fall.
The following assumes that the object in question has no initial velocity, though accounts for it anyway.
The way I’ve approached the problem:
local function Calc(s, g, v0)
local t, v, vAVG
-- A rearrangement of s = gt^2 / 2
t = math.sqrt((2 * s) / g)
-- An adaptation of v = gt, taking account of initial velocity
v = v0 + (g * t)
-- A mean average of the object's velocity
vAVG = (v + v0) / 2
local tbl = {
["height"] = s,
["time to fall"] = t,
["initial velocity"] = v0,
["final velocity"] = v,
["average velocity"] = vAVG,
["gravity"] = g
}
for k, v in pairs(tbl) do
print(k, string.format("%.2f", v))
end
end
Calc(script.Parent.Position.Y, workspace.Gravity, script.Parent.Velocity.Y)
Find a source here that explains the concepts and equations better.
Findings
The issue I’m facing is that, when I try to apply Newtonian mechanics mathematically, the values never align.
Using the above function with substituted values of:
- s [height] = 500 studs
- g [acc. due to grav.] = 35 studs per second^-2
I record that a uniform object undergoing free-fall with a constant acceleration will:
- take 5.35 seconds to reach 0 on the Y-axis
- have a final velocity of -187 studs per second^-1
However, in practice I find that the object will:
- take 7 seconds to reach 0 on the Y-axis
- have a final velocity of -181 studs per second^-1
I’ve spent a fair while on this, trying several different equations and practices, all to no avail - the findings are too imprecise.
I’m hopeful that my maths (not my strong suit) holds true, but is there something obvious that I’m missing, else why do the values differ so greatly?
Any help is appreciated, thanks!