
Bouncing a Ball
This exercise shows you how to bounce a ball against a box.
-
In the center of the Top viewport, create a box that’s about 200 length, 200 width, and 20 height. This is your floor.
-
Create a sphere that’s about 30 radius, and position it so it’s about 100 units over the center of the floor.
-
In the Create/Space Warps/Particles & Dynamics branch, click the Gravity button.
-
In the Top viewport, drag anywhere to create a Gravity icon.
You don’t need to bind the space warp to an object. You’ll use the Dynamics utility instead. Note, also, that the position of the gravity icon doesn’t matter, but its orientation does. In this case, you create it in the Top viewport so that gravity will pull downward.
-
Create a material with a Checker map (tiled 4x4), and assign it to the sphere. (You can use the default Dynamics Properties of the material.)
The purpose of the checker material is so you can see the rotation of the sphere.
-
Click Time Configuration, set the animation Length to 200 frames, and click OK.
-
Save your scene.
Now that you’ve got a scene, your next steps are to create a new simulation, and then tell the dynamics system which objects are going to be considered in the simulation.
-
In the Utilities panel, click the Dynamics button, and then click the New button to create a new simulation.
A new simulation name appears in the pop-up list.
-
Click the Edit Object List to specify the objects that will be in the simulation.
-
Select all three of the spheres listed in the window at left, click the > button to place them in the Include window at right, and then click OK.
(Note that, since all objects will be included in this simulation, you could alternatively have simply chosen the Exclude option in the dialog and left the objects in the window at left.)
And now, you’ll enter the Edit Object dialog, which contains most of the settings for the Dynamics utility. Here, you’ll specify the properties and relationships for each of the objects included in the simulation.
-
Click Edit Object.
The Edit Object dialog appears.
-
Choose Box01 in the pop-up list in the upper-left corner of the dialog. All controls in the dialog are specific to the object displayed in this pop-up list.
The first thing to specify for any object is whether or it’s immovable. As you’ll see, if the object is immovable, most other options in the dialog become disabled. Since the box object is the floor, it’s definitely immovable. (You don’t want it to move downward when hit by the sphere.)
-
Check This Object is Immovable in the Misc Dynamic Controls area.
Much of the dialog becomes disabled.
-
Choose Box in the Collision Test area.
This tells the dynamics system that a bounding box will be used to represent this object during collisions. If your floor was complex in shapesuch as irregular terrainyou’d have to use the Mesh option, which would require much more calculation.
-
Choose Sphere01 in the pop-up list.
-
Make sure that Use Initial State is checked in the Misc Dynamic Controls area.
This means that, at the start frame of the simulation, the initial keyed transform of the object will be extrapolated.
-
In the Collision Test area, choose Sphere.
-
In the Calculate Properties Using area, choose Bounding Sphere. (This determines what type of mass and volume is used for the calculations.)
Now, assign gravity to the sphere so it’ll fall.
-
Under Assign Effects/Collisions, click Assign Object Effects.
-
In the resulting dialog, move Gravity to the rightmost window, and click OK.
And, finally, specify the object with which the sphere will collide. (Notice that the sphere has to be aware that it will collide with the box, but the box doesn’t have to be aware of the sphere because the box is not reacting to the sphere.
-
Click Assign Object Collisions, move the Box01 to the rightmost window of the dialog, and click OK.
-
Click OK to exit the Edit Object dialog.
-
Save your scene (you’ll be using the saved version later).
You’re almost done. The final steps are to set your ranges, and then solve the animation.
-
In the Timing & Simulation rollout, set the Start Time to 0 and the End Time to 200. (End Time is probably already 200 because it picks up the current last frame when you begin a New simulation.)
-
Click the Solve button.
The progress bar travels across the Status/Prompt area.
-
Play the animation.
-
The ball drops and bounces on the box.
If you look in the Track View for the sphere, you’ll see that Position, Rotation, and Scale tracks have been generated for the sphere for each frame of the animation. Once you have an animation that works for you, you can reduce the number of keys by going into Edit Time display in the Track View, selecting all keys in all of the tracks, and then clicking the Reduce Keys button. This can take time, but it greatly reduces the size of your scene file.
Next, you’ll expand on the animation slightly by adding a couple of boxes.
-
Reload your original scene (the one you saved just before solving the simulation).
-
From the Front viewport, SHIFT-move the box diagonally down and to the right to create a second box below and to the right of the first.
-
Repeat the above step to create a third box below and to the right of the second.
The three boxes should be arranged as the equivalent of three stair steps.
-
Also from the Front viewport, move the sphere horizontally to the left so it’s hovering over the left edge of the top box. (If you were to drop it straight down, it would just miss the edge of the box.)
-
Go to frame 10, and turn on the Animate button.
-
In the Front viewport, move the sphere to the right until it’s just over the left side of the box.
-
Turn off Animate.
Before solving this, you’ll need to tell the simulation about the new boxes.
-
Click Edit Object List, and add the new boxes to the window at right.
-
Click Edit Object.
-
Choose each of the new boxes in the pop-up list, and then check This Object is Immovable for both of them. (Also, make sure that Box is chosen under Collision Test for each of them.)
-
Choose the sphere in the pop-up list, click Assign Object Collisions, and then add the two new boxes to the window at right, so that all three boxes are considered for collisions.
-
Click OK to exit the Edit Object dialog.
-
In the Timing area, set the Start Time to 5. (The simulation picks up the movement of the sphere at frame 5 and extrapolates.)
-
Set the End Time to 200.
-
Click Solve.
-
Play the animation.
The sphere bounces down the stairs.
Depending on the positioning of the three boxes, and the amount of movement of the sphere before frame 5, the sphere might bounce past one or more of the boxes. Here are some adjustments you can try:
-
Reposition the boxes, and then click Solve again to see the result.
-
In the Materials Editor, go into the Dynamics Properties for the material assigned to the sphere, and reduce the Bounce Coefficient (so the ball isn’t as bouncy).
-
Assign materials to the boxes, and reduce their Bounce Coefficients, as well. (You can assign different materials to each box so the ball bounces differently with each it strikes.)
Some other things to try:
-
Uncheck This Object is Immovable for one of the boxes (such as the center one) and see what happens.
-
Experiment with the Static Friction and Sliding Friction settings in the material Dynamics Properties. Watch how it affects the spinning of the sphere as it hits a surface.
-
Replace one or more of the boxes with more complex objects. For example, make a bowl object by deleting half the vertices in a sphere, and then flipping its normals. Don’t forget to set the Collision Test to Mesh for an object like this. Otherwise, it’ll simply use the bounding box of the object.