I am trying to create a simple simulation where a ball is thrown in x-direction and the gravity pulls the ball to the ground.
I have trouble to apply the appropriate air resistance in my calculation, which looks like this at the moment:
this.xVelocity = 5 - ((0.18 * 0.1*(1.2/2)*this.xVelocity*this.xVelocity) / 5)*this.seconds;
this.xpos += 0.5*this.xVelocity * this.seconds;
5 is the velocity of the ball in x-direction.
this.yVelocity += 9.81*this.seconds - ((0.18 * 0.1*(1.2/2)*this.yVelocity*this.yVelocity) / 5)*this.seconds;
this.ypos = 0.5*this.yVelocity*this.seconds;
Where 0.18 is the coefficient of resistance (c), 0.1 is the surface area of the ball (10*10cm), 1.2 is the air density and 5 is the mass of the ball
Am i doing this right?