-- R = 600 -- How far away is your target? Studs
-- G = 9.81 -- This is the acceleration that the force fo gravity produces on everything
-- i wouldn't change that number unless you know what you are doing.
-- V = 100 -- How fast does the bullet go? Studs per second.
-- wait(1)
-- local a = math.deg((math.asin(R*G/(V^2)) / 2))
-- print(a) -- a is the angle at which to fire for a direct hit.
--=============== dont copy below
Just want to mention that i don't know much about scripting. How i made this was asking for help from Quora.com you can find geniuses there.
If anyone can help and give this mortar some extra lines of code that can tell it which direction to aim horizontally and to consider the distance increase in the event of elevated positions. Maybe use pythagoras theorem to calculate the horizontal distance from target and vertical distance target to replace with R or "How far away is your target" variable. Most importantly. How to get the Bullet to have this initial velocity when fired? Bodythrust or force or velocity or what?
have a good day everyone.
Closed as off-topic by SaltyPotter and Rare_tendo
This question has been closed by our community as being off-topic from ROBLOX Lua Scripting.
Why was this question closed?