Time for action – exploring the Nissan GTX
Open the file
ch4_CameraTypes.html
in your HTML5 browser. You will see something like the following:Go around the world using the sliders in Tracking mode. Cool eh?
Now, change the camera type to Orbiting mode and do the same.
Now, please check that besides the slider controls, both in Tracking and Orbiting mode, you can use your mouse and keyboard to move around the world.
In this exercise, we have implemented a camera using two new classes:
Camera
: to manipulate the camera.CameraInteractor
: to connect the camera to the canvas. It will receive mouse and keyboard events and it will pass them along to the camera.
If you are curious, you can see the source code of these two classes in
/js/webgl
. We have applied the concepts explained in this chapter to build these two classes.So far, we have seen a cone in the center of the world. Let's change that for something more interesting to explore.
Open the file
ch4_CameraTypes.html
in your source code editor...