Tennis Ball Movement Algorithm: Get Help Here

In summary: Air resistance is irrelevant because the only thing that affects the acceleration of the tennis ball is gravity.
  • #1
Gigs_
3
0
Hi all!

Im working on a small 3d tennis game, but I am not good with math.
Can anyone make me algorithm for tennis ball movement (simulation).

I have this parameters: ball starting point (x=left/right,y=up/down, z=is forward/backward), ball ending/bounce point which y is always 0. y at (z=0) should be 40, spin parameter which is basically here just to make ball goes over net in different situations. So basically i need to calculate parabola.thanks!
 
Last edited:
Physics news on Phys.org
  • #2
someone, please


just few guidelines if not all
 
  • #3
Treat every axis as being completely independent of the others and that will make you life so much easier. It means that you only need worry about air resistance, and in the case of the vertical axis, gravity.

To get a realistic movement due to air resistance, you'll need to use the drag equation:
[tex]F_{d} = -0.5 \rho v^{2}AC_{d}[/tex]
And also this formula:
[tex]F = ma[/tex]
And this one:
[tex]v = u + at[/tex]

Now, this part isn't mathematically correct, but if you consider only small steps forward in time, (1/1000 of a second for example) you can consider the drag force as constant over that time period, which allows you to do something like this:
[tex]ma = -0.5 \rho v^{2}AC_{d}[/tex]
[tex]a = (-0.5 \rho v^{2}AC_{d})/m[/tex]
[tex]a = -(\rho v^{2}AC_{d})/2m[/tex]

This equation is getting to be a bit much, so to make it simpler, we can ditch lots of terms that don't change and replace them with a single constant. Specifically the frontal area of the ball (does actually change, but not very much), the coefficient of drag, the density of the air, and the mass of the ball. I'll use m = 0.06 Kg, diameter = 0.0635 m, air density = 1.2 Kg/m^3, coefficient of drag = 0.3 and t = 0.001 s. This leaves us with:
[tex]A = 0.03175^{2} * \pi = 0.003167[/tex]

[tex]a = (1.2 * v^{2} * 0.003167 * 0.3 * 0.001)/(2*0.06)[/tex]
[tex]a = - 0.0000095v^{2}[/tex]

This will give the acceleration of the tennis ball in the opposite direction to it's direction of travel (if you consider the tennis balls direction to be positive). Or in other words, it's deceleration.

For this next bit, we need to come up with two equations, one for if the ball is traveling in the positive direction (ie: v>=0) one for traveling in the negative (v<0). First up is the positive:
[tex]v = u - 0.0000095u^{2}[/tex]

And now the negative:
[tex]v = u + 0.0000095u^{2}[/tex]

Notice I changed the v to u, because u is initial velocity and v is final velocity.

So there you have a simple way to calculate the new velocity after 1/1000 of a second. You simply plug in the old velocity as u and out pops the new velocity v. Oh, and the velocity is in meters per second.

Well those formulas can be used as-is for the horizontal plane, but what about vertically? There's also gravity to worry about. Well as luck would have it, this is way simpler to work out than the air resistance formula, because the acceleration due to gravity is always 9.8 m/s^2 down.

Just like before we need two different formulas due to the air resistance factor, firstly if the ball is going up (v>=0). In this one gravity and drag are working against the direction of travel:
[tex]a = -g - F_{d}/m[/tex]
[tex]v = u - gt - F_{d}t/m[/tex]
[tex]v = u - 9.8*0.001 - 0.0000095u^{2}[/tex]
[tex]v = u - 0.0098 - 0.0000095u^{2}[/tex]

And now if the ball is going down (v<0):
[tex]a = -g + F_{d}/m[/tex]
[tex]v = u - gt + F_{d}t/m[/tex]
[tex]v = u - 9.8*0.001 + 0.0000095u^{2}[/tex]
[tex]v = u - 0.0098 + 0.0000095u^{2}[/tex]

None of these equations take account of spin, which would alter the acceleration in mid air slightly, and especially so when the ball bounces. I'm afraid I wouldn't know where to begin to take account of spin.
 
  • #4
thx for replay. air resistance is irrelevant.
 
  • #5
If air resistance is irrelevant what's the problem? The only issue would be gravity.

Also, why is air resistance irrelevant?
 

Related to Tennis Ball Movement Algorithm: Get Help Here

1. What is the Tennis Ball Movement Algorithm?

The Tennis Ball Movement Algorithm is a set of instructions that determine the trajectory and direction of a tennis ball when it is hit by a player. It takes into account factors such as the speed and angle of the racquet, the surface of the court, and the air resistance to predict the path of the ball.

2. How does the algorithm work?

The algorithm uses mathematical equations and principles of physics to calculate the movement of the tennis ball. It considers the initial conditions of the ball, such as its position, velocity, and acceleration, and then uses these values to determine its path as it travels through the air.

3. Can the algorithm be applied to all types of tennis shots?

Yes, the Tennis Ball Movement Algorithm can be applied to all types of tennis shots, including serves, groundstrokes, and volleys. It takes into account the different techniques used for each shot and adjusts the calculations accordingly.

4. How accurate is the algorithm?

The accuracy of the algorithm depends on the accuracy of the initial conditions and the assumptions made. In controlled environments, such as a laboratory setting, the algorithm can be highly accurate. However, in real-life situations, there may be external factors that can affect the trajectory of the ball, resulting in slightly less accurate predictions.

5. Can the algorithm be used to improve a player's performance?

The Tennis Ball Movement Algorithm can be a useful tool for players to understand the mechanics of their shots and identify areas for improvement. By adjusting the initial conditions and observing the predicted outcomes, players can make changes to their technique and see how it affects the movement of the ball. However, the algorithm alone cannot guarantee an improvement in performance; it should be used in conjunction with other training methods.

Similar threads

  • Introductory Physics Homework Help
Replies
2
Views
1K
Replies
2
Views
1K
  • Introductory Physics Homework Help
Replies
14
Views
2K
  • Introductory Physics Homework Help
2
Replies
47
Views
3K
  • Introductory Physics Homework Help
Replies
3
Views
662
  • Introductory Physics Homework Help
Replies
4
Views
742
  • Mechanics
Replies
7
Views
3K
  • Introductory Physics Homework Help
Replies
4
Views
1K
Replies
4
Views
4K
  • Introductory Physics Homework Help
Replies
2
Views
1K
Back
Top