# quick math

• 07-06-2005
firefly
quick math
ok im working with a graph and im making it so if i click somewere and it makes a ball that ball will go twords another point.
what i have to work with is a function than is like this :
Code:

`create(baseball,xstarting position,ystarting position,x velosity,y velocity)`
i have it so it will get the position of the mouse for position xstarting position , ystarting position and i dont know how to make it so i can give it a velocity that will got twords another position all the time and the other position is moving? and help??
• 07-06-2005
xErath
considering time in seconds the position of the ball will be, disregarding attrition
Code:

```        | x = x_initial + v_x * time pos(t) = |         | y = y_initial + v_y * time + 9.8 * time^2 / 2```
in 'y' you have to account for the gravity.
Then you have to solve a system of equations. You know the final position (x, y) and the initial position (x, y). 2 variables remain (vx, vy) and 2 equations. Solve the system.