I am trying to calculate flight time of a bullet given initial velocity of 1000.
Code:
local Vel = 1000
local Height = 1
local Formula = (Vel * math.sin(10) + math.sqrt(Vel * math.sin(10))^2 + 2 * 33 * Height) / 33
print(Formula)
The answer appears to be nan however the website I am using claims the answer is 10.8. I don’t quite understand how the answer is different considering we are using the exact same formula.
Any help would be nice to understand what I am doing wrong.
Fixed:
Code:
local V0 = 10000
local Sine = math.sin
local G = 33
local H = 1
local Theta = 10 * (math.pi / 180)
local T = (V0 * Sine(Theta) + math.sqrt((V0 * Sine(Theta))^2 + 2 * G * H)) / G
local D = V0^2 * Sine(2 * Theta) / G
print(D, T)
Are you are calculating time of an arced projectile?
If it’s a horizontal projectile no matter what it’s forward velocity it will take the same time to drop 10 studs if the forward velocity = 0 units or 100000 units.
If it’s the time it takes a straight projectile to go from a gun to a target then it’s just time = distance / speed.
What formula are you using from the website? Does it calculate for earth gravity or Roblox gravity.
Edit *nevermind