Accessibility

Table of Contents

Creating Advanced Interactive 3D Content with the Chrome Lib Set of Behaviors

Creating a Button User Interface to Turn the Headlights On/Off

In this section, you give the user the ability to turn the car headlights on or off when they click the User Interface buttons.

  1. Create a new movie and give the Stage a size of 640 x 320.
  2. Using the files you downloaded from TurboSquid, import the following files into the internal cast:

    • opel_signum.w3d
    • alloy_wheel_16_inch_elegance.w3d
    • alloy_wheel_17_inch_cosmo.w3d
    • alloy_wheel_17_inch_sport.w3d

  3. Drag the opel_signum cast member onto the Score.
  4. In the Property inspector, change the width and height of the W3D sprite to match the size of the Stage (640 x 320).
  5. Follow the steps described in the first article to set up the W3D scene, excluding the step to hide the light beams.
  6. You may also set up hardware anti-aliasing using the following steps:

    1. Drag the Anti-Aliasing behavior from the Chrome Lib to the W3D sprite, either on the Stage or in the Score.
    2. Check the Hardware Anti-Aliasing box. Click OK.
    3. Click the Play button in the Control panel or press Enter to start the movie. The scene is now anti-aliased and looks much better.
  7. Using the sample files linked at the beginning of this article, import the following images into the internal cast:

    • headlights_off_normal.png
    • headlights_off_selected.png
    • headlights_on_normal.png
    • headlights_on_selected.png

    Figure 1 shows the internal cast after having imported all the assets and setting up the 3D scene.

    The internal cast after having imported all the assets and setup the 3D scene

    Figure 1. The internal cast after having imported all the assets and setup the 3D scene

    As shown in Figure 2, you can see there are three behavior instances in the behavior tab of the Property inspector.

    Three behavior instances in the behavior tab of the Property inspector

    Figure 2. Three behavior instances in the behavior tab of the Property inspector

  8. In the Score, copy the opel_signum sprite and paste it to create a second one. The first sprite holds the scene initialization behavior instances. The second will hold all the interactivity.

    The Score showing the two instances of the opel_signum sprite.

    Figure 3. The Score showing the two instances of the opel_signum sprite.

  9. Hold on the last frame by using the Hold on Current Frame behavior in the Navigation library.
  10. Click the Play button in the toolbar or press Enter in the numeric keypad. The movie starts and the scene appears as shown in Figure 4.

    The movie with the Hold on Current Frame behavior enabled

    Figure 4. The movie with the Hold on Current Frame behavior enabled