Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to simulate the environment on a Squash Court on Android with my own physics and using OpenGL for visualization. Basically, its about a rubber ball bouncing around in 3d, not just on the floor but also on the walls.

What I'm not quite sure about is what kind of physical concepts are altering the movement of the ball or how much they are.

  • Obviously there's gravity...
  • Also, air friction, but I'm not sure how to calculate air friction of a rubber ball that is roughly 40mm in diameter. I've tried different formulae but I wasn't happy with them (eg. some were linear to speed and some were quadratic lol) and I was missing some material-dependant constants.
  • Then there's the normal force applied from the solid shape on which the ball bounces. I don't think I need to alter any values as the normal force is "taken into account" by changing the ball's direction. I mean, if the solid shape where the ball bounces is vertical, normal force is zero but the ball still changes direction. Correct?
  • Now, every collision reduces the kinetic energy as it emits sound and warms the ball. I assume that this reduction is greater if the ball hits the solid shape on a tighter angle. Is there a way to quantify it? So far, all I could do was use values "to make it look like it might be".
  • Furthermore, I suspect that the angle at which the ball hits the shape is not equal to the angle in which it leaves the ball. Obviously, if the ball hits at 90° (orthogonal), then it will leave at 90°. On the other hand, if the ball hits at, say, 45°, it might leave at 30° (compared to the solid shape eg. the floor).
  • There is spin which I have not spend much thought on but if anyone knows where I might find something about that I'd be greatful.
  • Other forces/effects on the trajectory of the ball...??

Thanks in advance :)

Edit: To summarize, I am looking for (1) an applicable formula that represents air friction with possible constant values depending on the rubber-ball-scenario, for (2) a confirmation that my way of handling normal force is correct, that (3) a way of quantifying energy loss of the ball in a collision, (4) how (if) the angle after the collision is altered, with regard to the incoming angle, and lastly (5) how to handle spin.

share|improve this question
    
You should look at gamedev.stackexchange.com/questions/13851/… It seems it handles what you need. –  Lighthink Feb 23 at 8:43
    
Thanks, but that is not quite what I'm looking for. In case I wasn't clear, I added a summary, what I am looking for.As far as I can tell, the other user is having the same problems that I managed to solve earlier in my project. My problems are regarding the physics of specific materials. So far I tried different values but there are lots of parameters which makes "brute force" quite difficult. –  mystyfly Feb 23 at 11:10
    
Do you have any ( online if possible) game as example ? –  tigrou Feb 23 at 11:14
    
I'm not quite sure what you mean. I'm trying to simulate a Squash game, so that's how it should look though I'm yet to implement more than the court and the interaction of the ball with the court. My project is located on github, with the interesting class here. However, I'm trying out things so it might look messy at times... –  mystyfly Feb 23 at 12:49
    
This is a tough question to handle. Not because of the physics involved, but because I think most responders will only respond to a few (less than 5) of your questions at a time. But for you to mark an answer as correct, all 5 would need to be addressed in a single answer. I find I'm itching to respond to your #5 but reluctant to put is in an answer because it would seem like such an incomplete one. –  Steve H Feb 23 at 15:56

1 Answer 1

up vote 3 down vote accepted

That this question is quite broad makes it quite difficult to answer, but the basic physics that would go in to it could be summarized as:

  1. Gravity - As long as the ball stays within moderate height (within the squash court), this could be treated as a constant.
  2. Air Resistance -

    Also, air friction, but I'm not sure how to calculate air friction of a rubber ball that is roughly 40mm in diameter.

    This is not an issue since smaller objects having smaller surface areas does not suffer much air resistance. But this does have an effect in the long run. Below is an example of a bullet (much higher velocity than a squash ball). While bouncing on the ground, air resistance will reduce the horizontal range of the ball (its parabolic trajectory) and will effect the game!enter image description here
    The equation connecting velocity of motion to the force (linear) is as follows:
    enter image description here rho is the density of the medium, Cd is the drag coefficient and A is the drag area (enter image description here).

  3. Collisions - Refer to inelastic collision in 2D and extend it to 3D. You'll simply need to calculate energy loss from this collision. Sound, and heat effects are a bit of an overkill. Sound is pre-set in the game anyways, and heat is visible in the expansion of the material, and for a 40 mm ball that is next to nothing.
  4. Spin - believe it or not, spin could be one of the most toughest things to calculate compared to other parameters above. We know angular momentum isn't conserved when there is a torque. Thus, inorder to calculate the rate of change of ang.momentum (ang. acceleration), we'd need to calculate moment of inertia and thereby the torque, or forget Newton's method and set up the whole thing with Lagrange's equations instead(Makes it a lot easier). But, if you could build a system of spin for the ball itself, then it would be quite easier to keep track of it while it touches a surface (at any angle) and calculate the torque right away.
    Note: There is something called a Magnus effect that you might want to look in to (overkill).

  5. Rolling - Similar to spinning, but a much simpler equation depending on the rolling-friction and moment of inertia of the ball. (I can't give a link due to lack of reputation)

share|improve this answer
    
Wow, awesome! About air drag, I've seen this formula before but the constant Cd was not properly explained (or I misunderstood). I'm not quite sure about the collisions, I guess I'll have to keep experimenting there, to find a decent value (for the coefficient of restitution). In Squash, the temperature of the ball has a big influence on the height of the bounce. So are you saying that the change of the angle at which the ball bounces off the surface depends on the spin, not the angle it had before? I'm sorry, my physics classes are a few years back - and in german... Thanks a lot! –  mystyfly Feb 23 at 19:00
    
A sphere has no particular angle relative to the ground unless we fix one from the beginning. What causes it to rotate (change relative angle) is the friction on the surface that create a torque. Imagine you are in the ball's frame and the ground is moving backwards. The ground will appear to rub against the ball thereby rotating it. So, this also implies if the coefficient of friction between the ground and ball was zero, no rotation would take place (called slipping). –  Renae Lider Feb 24 at 16:52
    
Thanks, you've given me a lot to think about! You mention friction when the ball hits a surface which creates a torque. Which kind of friction is applied there and how do I calculate it? (None that I learned at school seems to apply.) Could you please post a link to that if you have and the link to rolling that you mentionned in your initial answer? –  mystyfly Feb 24 at 21:23
    
Ground-ball friction. Rolling friction. Kinetic energy of rolling body. One more thing: Will a ball start rolling without friction? No it won't, someone should give that torque to start the rotation (ang. momentum conservation) –  Renae Lider Feb 25 at 8:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.