I am throwing a ball using this:
double v, vx, vy, alpha, t2 = 0;
if (Keyboard.GetState().IsKeyDown(Keys.Up))
{
alpha = MathHelper.ToRadians(60f);
v = -1230d;
vy = v * Math.Sin(alpha);
vx = v * Math.Cos(alpha);
ball2pos.Y = (float)((vy * t2) + (g * t2 * t2 / 2)) + graphics.GraphicsDevice.Viewport.Height - ball2.Height;
ball2pos.X = (float)(-vx * t2);
t2 = t2 + gameTime.ElapsedGameTime.TotalSeconds; }
It works without a problem. It calculates the throw including the gravitation (g). vx is how much it moves per second on the X,vY the Y accelerration (running against gravity), v the strength of the throw and t2 the current time.
But I want to change the formula to throw the ball to a given destination. Say I want to throw my ball from 60 degrees to a target. How much "strength" do I need for it?
What would be the formula? I'm not really good at figuring out that and google doesn't give me what I want. To simplify let's assume that the Y of source and target are the same:
Given: Angle, SourceLocation, TargetLocation, Gravitation
Looking for: Strength