Example—MiniDisc Player
The completed MiniDisc
player object as well as all the files used in this tutorial are available in the …\Objects\
directory located in the Cult3D Designer folder.
|
 |
figure 1—MiniDisc Player
|
 |
|
The scene graph includes all the scene data included in the Cult3D Designer file [*.c3d],
such as cameras and object information. If the objects are placed in a hierarchy, the hierarchy is
shown in the scene graph. An example of a MiniDisc Player object, shown in the Preview window [figure
1], has a scene graph, as shown in figure 2.
To define the events of specific objects
An icon is thus created for the selected sub-object.
To further define the scene
 |
When the specific sub-object is shown in the Event Map, drag that object onto a created event. |
|
 |
Figure 3—Event Map
|
 |
|
In the Event Map a connection is shown by a drawn line between the object and the event connected
to it. So if, for instance, you want to make the Button-PlayPause accessible
with a left mouse button event, then the Event Map would look something like figure 3.
With the action menu shown in figure 4 you can define actions of the events created for the
specified objects. For this example we want to bind a play sound action.
 |
Just drag the play sound text to the Event Map area. |
 |
Then release it onto the event we just created (Event_1) which is
assigned to the Button-PlayPause object. |
To load a sound resource into the scene, we need to go via the View
menu and select Sounds. From that dialog we can add all the sounds we
want to include in this scene.
When the sound is loaded (either a sample or a midi song):
 |
Drag that line onto the Event Map. |
There a sound icon will be created with the name of the sound added.
 |
Connect the sound to the play sound action. |
When all this is done, the Event Map should look something like in figure 5.
But of course we need to define the Button-Stop, so that the playing
music stops.
 |
Drag the Button-Stop object from the simulation view to the Event
Map area while holding down the control key and release the button. (If you left-click an object
in the Preview window, you can see what is selected in the Scene Graph.) |
 |
Add one more Left Mouse button event. |
 |
Connect the Button-Stop to the newly created event (Event_2). |
 |
Add a stop sound action to the event. |
 |
Drag the sound you want to stop playing to the stop sound icon. In this case, canyon. |
Remember that all the sounds are included in the Cult3D Player file [*.co],
so if there is a large amount of samples (i.e., full CD quality [16bit, 44KHz, stereo] or a very long
play time), it will affect the file size.
More Actions
Included into the MiniDisc Player scene, there is an object representing the actual MiniDisc media.
To make this interactive, we need to make the disc pop out when the user pushes Eject.
 |
Start by selecting the Lever-Eject object and drag that to the Event
Map area while holding down the control key. |
 |
Add one more Left Mouse button event. |
 |
Connect the Lever-Eject object to the new event. |
To make the disc move, we need to use a Translate action (found under
Object motion, as seen in figure 6).
 |
Drag the Translate action to the Event Map and release it onto the
new event icon. |
Since we can not yet see the MiniDisc media, we have to select the media object from the scene graph
instead of dragging it from the simulation view window.
 |
Select the object, move it, and release it onto the Event Map area. |
 |
Drag the media object and release it on the Translate action to make
the connection between the two. |
 |
Double-click the Translate action to open the dialog that lets you
define the translation values. (The translation values use the same units as your 3D modeling program.
One unit in your modeling program equals one unit in Cult3D.) |
We need to translate (move) the MiniDisc media -20 units in the Y-axis, and the performance should
take two seconds.
 |
Enter 2000 into the performance duration edit box (since
2 seconds is 2000ms.) |
Since we want to be able to re-insert the MiniDisc media object, we will let the user click the media.
 |
Add another left mouse button event to the Event Map area. |
 |
Make a connection by dragging the MiniDisc media icon on to the new
event. |
 |
Add another translation action to the new event. |
 |
Set the Y-axis to 20 units and the duration to 2000 (again, since 2000ms is 2 seconds). |
Since this is a relative animation, the Preview window shows the media being ejected on the other
side of the player. This is actually correct. (To eject we move the media -20 units and so during
insert we need to move it 20 units in the opposite direction. It all cancels out in the end.)
The result should look something like figure 8.
There are two additional events shown in figure 8: Event_1 and
Event_6. These represent the World Start
and World Stop events. We are simply using the World
Start event to select a camera, and we use the World End to make
sure the sound is stopped before we exit.