From the course: Learning 3D Graphics on the Web with Three.js

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

Orbit controls

Orbit controls

- [Instructor] There is one more level of interactivity that we will add to our scene, and that's using orbit controls for the camera. 'Orbit controls' is a script that you can find inside the examples folder of three.js. It allows us to rotate the camera around the scene by just dragging our mouse on the screen. It will let us see what's going on much better by allowing for interactive camera movement. I have already downloaded orbit controls, and it's also included in the left folder of the project files. If you have been following along, you can copy and paste or enter this line into your HTML file to be able to start using orbit controls. Initiating orbit controls is very easy. You just need to instantiate the orbit control with the camera and the renderer domElement. So after camera and the renderer is declared, we can find a line here and create variable called 'controls' and instantiate the orbit controls using the camera and the renderer domElement as arguments. You will be…

Contents