samedi 8 mars 2014

Calculate coordinates (x,y) of a ball at any given time


Vote count:

0




I'm making a simulation of a ball in the a 2D space, drawing its path.


I'm using g.fillOval(x,y,height,width); to draw the ball


The ball is affected by three forces : Gravity, Wind and shot-power, it also has a starting angle.


This picture demonstrates what i mean


enter image description here


Knowing that the ball starts from x=11 y=360


i want to change the value of x and y according to ball's position at any time given and under the mentioned forces..


an equation that would do that should be something like



x += Angle Power Gravity Wind
y -= Angle Power Gravity Wind


asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire