1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Tennis ball movement

  1. Feb 11, 2008 #1
    Hi all!

    Im working on a small 3d tennis game, but im 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: Feb 11, 2008
  2. jcsd
  3. Feb 11, 2008 #2
    someone, please


    just few guidelines if not all
     
  4. Feb 11, 2008 #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 travelling in the positive direction (ie: v>=0) one for travelling 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.
     
  5. Feb 11, 2008 #4
    thx for replay. air resistance is irrelevant.
     
  6. Feb 11, 2008 #5
    If air resistance is irrelevant what's the problem? The only issue would be gravity.

    Also, why is air resistance irrelevant?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Tennis ball movement
Loading...