Some projects that used to successfully use OrbitControls are now throwing an error. When included with
https://threejs.org/examples/js/controls/OrbitControls.js the following error is printed in the console:
TypeError: THREE.TOUCH is undefined[Learn More] OrbitControls.js:82:19
This is not the case if OrbitControls is included with, for example
Error example: https://codepen.io/anon/pen/vomjZV
Working example: https://codepen.io/anon/pen/wVdjdV
What is the new correct way to include OrbitControls in a project?
The documentation says:
When using code from the examples directory, it’s important that all files match the version of your three.js main file. For example, it’s not acceptable to use GLTFLoader and OrbitControls from R96 together with three.js R103.
So the solution is to update
three.js to the latest version
Thank you for the reply. Is including
https://threejs.org/build/three.js a safe way to keep a project linked to the latest version or should updates always be manual by specifying the version number (e.g.
Correct, this link provides the latest version of
Sorry, Where can I get this version?
The latest updated version is available at https://threejs.org/build/three.js .
You can include it in a website with
You can download a local version from https://threejs.org/ (Code->Download in the left bar)