Archived

This topic is now archived and is closed to further replies.

bouncing theory

This topic is 5377 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

do you mean in order to implement elasticity? (elastic rebounds)? or the effects of spin on the impact? or simple gravity? or the organization of an object oriented physics engine? etc?

Note: different materials of objects interact with different elastic propertiese ... in the real world the actual situation involves:

object makeup (mass, density, elastic properties)
the 2 objects elastic properties will yield 1 part of the result
another part comes from their angular momentum (spin and relative direct vs. sliding impact), which depends on the two objects surface tension (friction). and of course there is air resistance ... and gravity ...

So I always build up my physics models, 1 basic feature at a time ... here''s the order I might do things in.

1. Implement simple 100% elastic collisions, with no support for spin or gravity. In this case you can always assume angle of incedence = angle of reflection, and the velocity of the ball stays constant at all times (it only changes direction). Note, if your walls are all horizontal and vertical, this can be implemented easily by storing the balls velocity in X and Y components .. BUT if you want to support walls at other angles, you will find storing velocity as an angle and a momentum or speed might be easier (and just provide function to get the X and Y components if neccesary).

2. Add support for a simple elasticity factor ... so whenever an object impacts a wall, you change it''s velocity by a percentage ... (percentages greater than 100 create flubber, variable percentages create strange irregular objects).

3. Add support for the walls themselves having elasticity factors .. so the final outcome is a product of both factors.

4. Add support for objects hitting each other ... at first just assume they always have equal mass, and therefore both reflect.

5. Add support for different masses of objects (and fixed objects (with infinte mass) - to model the walls). So these objects can bounce off each other in different ratios.

6. Tweak the above feature so that it is based on FORCE (mass times velocity squared) instead of just mass ... to get more realism.

At this point you are done with simple, realistic standard bouncing ... and it should support worlds with various round objects, hitting flat or round surfaces. Add more if it serves some usefull purpose, otherwise, move on to other areas of your game.

Share this post


Link to post
Share on other sites
That was a handy explaination. Or at least I found it so.

PS: What's middle tennessee? I'm in Oak Ridge which I assume is Eastern, but being from Chicago I'm none to sure

[edited by - LilBudyWizer on March 26, 2003 9:46:10 AM]

Share this post


Link to post
Share on other sites
Say the ball is a sphere of position P and radius r and velocity V
the plane the ball bounces on is (N, d)
Cor is your coefficient of elasticity, Cof is your coefficient of friction

// distance of ball to the plane
colldepth = ((P . N) - r) - d

// found a collision
if (colldepth < 0.0f)
{
P -= colldepth * N // move ball to the plane surface
Vn = (V . N) * N // veloctiy of ball along plane normal
Vp = V - Vn // velocity of ball in plane
V = -Vn * Cor + Vp * Cof // new velocity with friction and restitution
}

simple Basic vector operations.

Share this post


Link to post
Share on other sites