I am using three.js (source code) in a module page:
requirejs-config.js
var config = {
map: {
"*": {
three: "Vendor_Module/js/three/build/three",
and in the phtml file :
require([ 'jquery', 'three', 'jquery/ui'],function($, THREE) {
It works.
I would like now to add one of the three.js tools called OrbitControl (source code). I did the same principle, ie :
requirejs-config.js
var config = {
map: {
"*": {
three: "Vendor_Module/js/three/build/three",
orbitcontrols : "Vendor_Module/js/three/examples/js/controls/OrbitControls",
phtml file :
require([ 'jquery', 'three', 'orbitcontrols', 'jquery/ui'],function($, THREE) {
but when I call it in my page script :
var controls = new THREE.OrbitControls( camera, renderer.domElement );
I have 2 errors in my browser console :
THREE is not defined in OrbitControls.js
THREE.OrbitControls is not a constructor
What did I miss?
Thank you for your help.