6.17.5 A Rolling Ball
In this example, we will create a table and some spheres on it. When
the table is tilted, spheres start to roll and fall down rebounding
from the floor. We will use the SWEEP method to tilt the table.
DIRECTED FORCE (gravity) and collision detection take care of the
rest.
1. Create an object consisting of a floor and a table cover. Make the
object very heavy by adding the tag FMAS 1000000 (one million
kilograms!) to it and nail it to the universe by setting its Protected
flag (use Modify/Properties/Attributes). Rename the object consisting
of the table and the floor as "table&floor".
2. Create table tilting mechanism using Animate/Create/Sweep. Set the
Start time of the sweep method (Modify/Properties/Animation) to 0.05 so
that it starts to tilt when the time reaches that value. This gives you
time to see how collision detection keeps the spheres on the table. Set
the End time of the method to 0.5.
3. Create some spheres on the table. Put them to the same hierarchy level
with the "table&floor" object.
4. Create a gravity field by using a DIRECTED FORCE method and an axis
parameter.
5. Create INT COLLISION and PROCESSOR methods.
|