Physics Mechanics : projectile motion help

Hello Everyone ,

I am working on soccer game. I come to know about projectile motion from which i can derive the motion and position of the ball after kicked.

I have referred video :

http://www.youtube.com/watch?v=ENFykifJf9E

Like this video, i want to allow user to select angle through trajectory line and distance will be constant(ball and goal net distance) and velocity will also be constant.

Then how will i make my ball to follow that path and if my ball hit the ground then ball should bounce again.

But i am facing problem how to write logic using this equations ?

Is there any other solution which give me same result?

I am facing so many problem since last week. I have tried so many code blocks and logic available. But could not able to derive the perfect solution.

Thanks for your help and advice in advance.

Please guys help me.

1 Answer

1

You can calculate the final force based on landing point of the ball using projectile equation :

y = -0.5gt*t+v0*sin(a)*t+y0 ; //for horizontal movement

x = v0*cos(a)*t+x0 ; //for vertical movement

now . you know what landing position is , and you know what is launch position is . so everything is ok . replace your variable in the equation.

x0 = landPosition.x;
y0 = landposition.y;
y = launchPosition.x;
x = lanchPosition.y;

and you know what is gravity(-9.8) and you know what is your angle( a ).so get the v by replacing your variable in the equation and then you can reach the force :
F = m*a .
notice that your v is a vector . so if your mass is equal one unit the you ca use this:

F = v .

we used this way to launch our character to destination point ( Bingo dingo game ) .