PDA

View Full Version : Bouncing a Ball (specific spacing) [Pivot][Physics]



Root
04-25-2015, 02:35 PM
I've seen a lot of people doing this in weird ways recently, so I thought I'd share my method of doing it. It is essentially using "double easing", which I'll explain a bit more later. There are also some aspects during the bounce to take into account, and variables of what materials the object is supposed to be made out of. A lot of this will seem really annoying and complex at first, but practice helps you start to do it automatically.

First, here is part of an OblivionFall tutorial that explains double easing pretty well:

The distance moved in pixels doubles on each frame.

Frame 1 - Pixels 1
Frame 2 - Pixels 2
Frame 3 - Pixels 4
Frame 4 - Pixels 8
Frame 5 - Pixels 16

|-|--|----|--------|----------------|--------------------------------|----------------------------------------------------------------|

This produces a reasonably quick build up in speed, which is also smooth. The curve on the graph is also reasonably smooth. This form of easing is simple to learn and I'm sure I'm not the only animator who has used this technique before.

Double easing isn't something that you would want to use for a punch or anything similar to that, but it happens to work perfectly for an object falling through the air.

In a simple test animation of a ball falling with little to no horizontal movement, you would use this spacing style (with arrow keys to make your life easier), accelerating the ball until it hits the ground. You probably won't want the ball falling too fast even when its dropping from a high distance, so I usually set a "terminal velocity" at 128 ppf (pixels per frame).

When the ball hits the ground, you have to take into account the material that it is made of. An extremely bouncy ball, made of rubber, would bounce the highest. To show this, I bounce it up at 1/2 the vertical "velocity" that it hit the ground at. For example, if it hit the ground on the 7th frame, and therefore at 64 ppf, it would bounce up 32 pixels in the first frame of the bounce. On the other hand, a ball with medium bounciness (lets say a soccer ball) would bounce up at 1/4 the velocity it hit the ground at. This would mean that, in the same scenario as mentioned before, it would bounce up 16 pixels. An even less bouncy material, such as (idk I don't do sports a lot) would bounce up at only 1/4 the velocity it hit the ground at, which would mean only and 8 pixel return for 64 ppf contact.

After the first frame of the bounce, the ball continues to rise at the "slow out" end of double easing. We'll use the bouncy rubber ball for this example. It initially bounced up 32 pixels. Now, in the next frame, we'll divide that value in half, and it will only move up 16 pixels. Then 8 pixels. Then 4. Then 2. Now, you might think that you would now move the ball up 1 pixel. This is actually probably fine depending on your physics style, but I personally skip that and just have the ball begin to fall down 2 pixels, and have the double easing begin all over again until the ball hits the grounds. Now, since the ball hit the ground at 32 ppf, you'll want to have the return in the first frame of the second bounce be 16 for our very bouncy ball.

This is pretty difficult to explain with just text, and pivs speak a lot louder than words, so here's an example of what I'm talking about. The far left is our very bouncy rubber ball, middle is our less bouncy soccer ball, and on the right is our even less bouncy (idk I don't play sports) ball.

http://fc00.deviantart.net/fs71/f/2015/023/0/0/gravity_test_by_rootofitall-d8f50so.gif
piv (http://sta.sh/027i39zwrnvo)

To Add:
horizontal movement
rotation and rectangles
other shit