realtlacitka.png (1143 bytes) Real3D Amiga Environment Real3D Amiga Tutorials Real3D Amiga Projects Real3D Amiga Macros Real3D Amiga Other Back to Real3D Amiga home page

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.

realtut6.17.5_1.png (4719 bytes)
YouTube Figure T6-53: Tilt the Table and the Spheres Fall Down.

6. Add the tag FFRI 1.0 to the table and the spheres. This makes the spheres also rotate (they don't just slide along the table).

7. Before we play the example, let us take a look at a tag called FREB. It allows you to define so called "rebounding factor" which defines how much a colliding object loses kinetic energy in the collision. The default is 1.0, which means that it does not lose kinetic energy at all. The value 0 causes object to lose all its kinetic energy making particles to stick to each other. So, save the animation now and play it. Then reset the time to 0, replace the object with the original one, add FREB 0.5 tags to the spheres and play the animation again.

ghh don'tpanic