Math help request - Trajectory formula

This isn’t specific to lua, but I thought this would be a decent place to ask it;
I happen to know that theta=0.5asin((gd)/v^2)).
theta=Angle of launch
g=Gravitational constant
d=horizontal distance to target
v=Initial velocity
(asin is inverse sine)

I now need to be able to calculate the required launch angle to send a projectile at given velocity to impact a target at horizontal distance d from the starting point of the projectile, as well as vertical distance Dy from the starting position.

The current formula works well when the target is at the same elevation as the point of origin. I need to somehow factor in Dy (vertical distance) to give me a new angle, to be able to strike targets that are at different elevations.

I hope I’ve been clear enough; Can anyone help?

so technically what are the things you know and what are the one that you dont? you know gravity is -9.8m/s2 … you also know your distance right? (asuming you figure that out with lua)

from that you can balance out the equation to find Dy no?

PS : logically , if you make the launch point rise but the trajectory arc stays the same , all you do is lower the angle… and vice versa , i might be wrong but that’s the picture painted in my head when i try and picture that.

What exactly are you trying to solve for?

What you are using is the suvat equations ( thats how I learnt it anyway) so they way you will have to solve this is my doing the equations twice one vertically and the other horizontally, ill put up a pic in a sec, ill just draw it

So first you know what the time is, and im guessing you want that to stay constant so lets say 8 seconds, you can fiddle with that time since source has a max velocity but anyway. You so you know time, gravity, and both vertical and horizontal distances. Oh and this is assuming theres no air resistance

so in the suvat equations:
s= displacement
u= initial velocity
v= final velocity
a= acceleration
t= time

so first lets find the vertical speed:
s = 100
u = ?
v = x
a = -9.81
t = 8

s=u+at
u=s-at
u=100-(-9.81)(8)
u = 178.48

Now we find the horizontal speed:

since speed = distance/time
u=200/8
u=25

Now you apply these in trig
so

That may seem like a huge angle but 8 seconds is a long time to keep it in the air, change it to like 4 and you will see different result or you can make time proportional to distance so it will provide different results

Great job dude.