O'Reilly logo

WebGL Beginner's Guide by Brandon Jones, Diego Cantor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — customizing the application

  1. Open the file ch9_Car_Showroom.html using your favorite code editor.
  2. We will assign a different home for the camera when we load the Ford Mustang. To do so, please check the cameraHome, cameraAzimuth, and cameraElevation global variables. We set up the camera home position by using this variable inside the configure function like this:
    camera.goHome(cameraHome);
    camera.setAzimuth(cameraAzimuth);
    camera.setElevation(cameraElevation);
    

    Let's use this code to configure the default pose for the camera when we load the Ford Mustang. Go to the loadMustang function and append these lines:

    cameraHome = [0,0,10]; cameraAzimuth = -25; cameraElevation = -15; camera.goHome(cameraHome); camera.setAzimuth(cameraAzimuth); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required