Interactivity
You can have the following two types of mouse interaction with your 3D scene:
On a material
On a 3D object
To make both types work, you need to define your viewport as well as your material as interactive. First look at how to set viewport interactivity to true, which will cause the viewport to listen for mouse events. By default, the interactivity value is set to false. There are several ways to set it to true, each of them require just a single line of code.
The first way is to change the interactive property of the viewport and set it to true.
viewport.interactive = true;
You can add this line anywhere in your code, as long as you have access to the viewport instance.
If you extend the BasicView class, like we do in all our examples, you can also use the fourth parameter in the super() method call, which stands for interactive:
super(640,480,false,true);
Make sure you add the super() call before calling startRendering().
When you're not working with an extended BasicView...