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
Oh god, no need for something this complex. Just use a Body Velocity object with a few lines of code. I didn't really understand what you wanted, but if you wanted a projectile to fly forwards from lets say the players Torso, this what you have to do
Make a body velocity object called bv or whatever
bv.maxForce = Vector3.new(math.huge,math.huge,math.huge) bv.velocity = player.Character.Torso.CFrame.lookVector * speed
You can turn speed into a negative for it to fly backwards.
You are welcome.