Here's my code so far:
Range = (script.Parent.Target.Position - script.Parent.Projectile.Position).magnitude
print(Range)
Degrees = 45
function Calculate(Range, Type, Vector)
if Type == "Initial Velocity" then
if Vector == "Y" then
local Calculation = math.sqrt(Range * 196.2 / math.sin(math.rad(Degrees * 2))) / 2
return Calculation
else
local Calculation = math.sqrt(Range * 196.2 / math.sin(math.rad(Degrees * 2)))
return Calculation
end
end
end
script.Parent.Projectile.Velocity = Vector3.new(Calculate(Range, "Initial Velocity", "X"), Calculate(Range, "Initial Velocity", "Y"), 0)
It calculates exactly how much force needs to be applied to land an object at a coordinate; however it has two problems. It only works on one axis, and not into negative Vector3 locations. I theorised that this would be fixed by finding the distance, and launching outwards after lookVectoring the part. I'm fine with both of these things, however I need help with launching the object to the right place, if say, I put the launch platform at a different horizontal angle.
I need it to launch directly forward of a part, any help and/or advice would be greatly appreciated.
Thanks, SquirrelOnToast

1 comment
Looking for it to fly in an arc of 45 degrees, and land on target. Found a piece of gear to help me though, it's called Throwing Axe or something.