I'm working on a 3D game where i need to shoot a projectile (arrow) in order to hit a target position. The projectile has an origin position and a motion vector v(t) where "t" is a time unit. v(t) represents both the direction and force/speed (vector lenght). At every time unit friction and gravity are applied to the motion and the projectile position is changed to the previous one + current motion . So, overtime the motion changes and so does the projectile position creating a kind of ballistic motion. The problem is: given the projectile origin and target position, what's the initial motion?
You can find all the equations, formulas
As you can see I'm already able to get the initial motion using a constant t but that makes the projectile slow or fast depending on the distance between target and origin because it will always take the same time independently from the distance. I'm bascally not able to choose the initial motion vector lenght (which is the arrow speed), it depends on the constant t used. So what i need is to calculate a t depending on the speed i need.
I'm thinking about getting the t from the motion vector lenght = speed equation but it's too big, and i don't even know if it's the right/best way