Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Have you ever wanted to make a realistic mortar? Well i present you these lines of code. [closed]

Asked by
MSDLF -17
5 years ago
Edited 5 years ago

-- 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.

0
please use code blocks :p theking48989987 2147 — 5y
0
your question title isn't a question DeceptiveCaster 3761 — 5y

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?