Goodies! Bookmarking them now. Thank you so much! b(^ 0 ^)d

EDIT: Interesting rugby ball bouncing simulation.

https://arundquist.wordpress..com/2015/07/06/rugby-ball-bouncing/

14 posts
• Page **2** of **2** • 1, **2**

Message: bloodshot can only post plain text URLS until they have 500 rep. **1** URLS modified. Why?

Goodies! Bookmarking them now. Thank you so much! b(^ 0 ^)d

EDIT: Interesting rugby ball bouncing simulation.

https://arundquist.wordpress..com/2015/07/06/rugby-ball-bouncing/

EDIT: Interesting rugby ball bouncing simulation.

https://arundquist.wordpress..com/2015/07/06/rugby-ball-bouncing/

**Posts:**55**Reputation:**18,478

B

15
S

7
G

34
Ok, here's the general purpose case with any ellipse bouncing on the floor with friction.

https://dl.dropboxusercontent.com/u/542 ... tion2.capx

Any other shape can work too, it just requires mass, inertia, and contact point calculations.

https://dl.dropboxusercontent.com/u/542 ... tion2.capx

Any other shape can work too, it just requires mass, inertia, and contact point calculations.

**Posts:**5,274**Reputation:**69,959

B

92
S

32
G

107
Sweet! Now trying to understand how it works. Thanks!

@R0J0hound

Played around with the capx a little bit.. I added a ground sprite with the condition if ball.Y > ground.Y-ry. But I think this is not the way to go if I want the ball to bounce off other object/obstacle/instance as well. Any tip/advice on how to make it bounce/interact with other instances or sprite objects using this method? Thanks! - bloodshot

@R0J0hound

Played around with the capx a little bit.. I added a ground sprite with the condition if ball.Y > ground.Y-ry. But I think this is not the way to go if I want the ball to bounce off other object/obstacle/instance as well. Any tip/advice on how to make it bounce/interact with other instances or sprite objects using this method? Thanks! - bloodshot

**Posts:**55**Reputation:**18,478

B

15
S

7
G

34
Hmm, I seemed to have missed your last reply.

The math is the capx is simplified for just horizontal ground. The first step would be to make it work with any angle. Actually you can do this by taking the velocity and using a dot product with the angle of the surface to get perpendicular and parallel velocities that can be plugged into the equations already there. That covers getting the bounce math to work.

Next the collision detection and resolution would need an overhaul. This is what keeps the football from falling through the floor at low speeds and lets us know when to bounce. It is also what gives us the point of collision. Right now we have oval vs horizontal line working. New would be oval vs any line. The math there isn't too pretty which explains why ovals aren't usually a common shape in physics libraries. Also you'll need to work out the formulas. Either that or use the iterative approach.

Ok, next we need oval vs oval collision detection. The simplest solution is to convert the oval to a polygon first. Then you'd take the two ovals and see if they overlap. If they do we need to separate them till they collide at only one point. The two ways to do this is to either move backward in time to they just touch, or use something like SAT or GJK/EPA to move them apart.

That just covers the simple case of only one moving oval and everything else is static. For collisions between two moving objects the bounce math now needs to use the relative velocity (Va-Vb) between the two objects instead of just the velocity of one. Otherwise the stuff above is more or less the same.

One caveat is when there are multiple objects that need to be pushed out of each other, then correcting one pair can push them into other objects. This is usually solved by repeating this check multiple times to reduce the amount of objects overlapping. You'll also want to make collisions faster by checking if the object's bounding box is overlapping first, before the other more costly oval-oval collision check.

In summery you will be creating a full blown physics engine. I have roughly outlined one approach, but there are many tweaks that improve speed and accuracy.

The math is the capx is simplified for just horizontal ground. The first step would be to make it work with any angle. Actually you can do this by taking the velocity and using a dot product with the angle of the surface to get perpendicular and parallel velocities that can be plugged into the equations already there. That covers getting the bounce math to work.

Next the collision detection and resolution would need an overhaul. This is what keeps the football from falling through the floor at low speeds and lets us know when to bounce. It is also what gives us the point of collision. Right now we have oval vs horizontal line working. New would be oval vs any line. The math there isn't too pretty which explains why ovals aren't usually a common shape in physics libraries. Also you'll need to work out the formulas. Either that or use the iterative approach.

Ok, next we need oval vs oval collision detection. The simplest solution is to convert the oval to a polygon first. Then you'd take the two ovals and see if they overlap. If they do we need to separate them till they collide at only one point. The two ways to do this is to either move backward in time to they just touch, or use something like SAT or GJK/EPA to move them apart.

That just covers the simple case of only one moving oval and everything else is static. For collisions between two moving objects the bounce math now needs to use the relative velocity (Va-Vb) between the two objects instead of just the velocity of one. Otherwise the stuff above is more or less the same.

One caveat is when there are multiple objects that need to be pushed out of each other, then correcting one pair can push them into other objects. This is usually solved by repeating this check multiple times to reduce the amount of objects overlapping. You'll also want to make collisions faster by checking if the object's bounding box is overlapping first, before the other more costly oval-oval collision check.

In summery you will be creating a full blown physics engine. I have roughly outlined one approach, but there are many tweaks that improve speed and accuracy.

**Posts:**5,274**Reputation:**69,959

B

92
S

32
G

107
14 posts
• Page **2** of **2** • 1, **2**

## Who is online |

Users browsing this forum: brunopalermo, jorgmaquoi, kiki4construct, NN81 and 27 guests |