OrbitControls in threeJs editor

Hello guys,

I’m currently working on a threeJs project but in the Editor and i’m having a hard time getting the OrbitControls to work in the ‘editor environnement’.
So of course I already searched about this problem on internet and one of the solutions I found (javascript - How do you add controls from inside the three.js editor - Stack Overflow - Last suggestion) is to use a modified OrbitControls made for threejs/editor

but when i copy this code into the script of my scene :

function loadOrbitControls()
	var orbitcontrols = document.createElement('script');
	var controls = null;
	// Original OrbitControls: "https://threejs.org/examples/js/controls/OrbitControls.js";
	// Modified OrbitControls : https://gist.githubusercontent.com/expressiveco/030e6bfa4cdfc39735824b8c743d6223/raw/dd5df633e4cd3e774f032ee640290db8e22af2d8/OrbitControls.js;
	orbitcontrols.src = "https://gist.githubusercontent.com/expressiveco/030e6bfa4cdfc39735824b8c743d6223/raw/dd5df633e4cd3e774f032ee640290db8e22af2d8/OrbitControls.js";
	orbitcontrols.onload = function () {
		if (!controls && MyTHREE.OrbitControls) controls = new MyTHREE.OrbitControls( camera, renderer.domElement );

I get this error in the console :

VM6572:26          GET https://gist.githubusercontent.com/expressiveco/030e6bfa4cdfc39735824b8c743d6223/raw/dd5df633e4cd3e774f032ee640290db8e22af2d8/OrbitControls.js net::ERR_FAILED

I’m new with threeJs so please excuse me if I did an obvious mistake or if I didn’t give enough information for you to help me out.

Also here is the 'publish
publish.zip (247.2 KB)
’ of my threejs/editor project.

Thanks for your help.

The solution you have picked from stackoverflow isn’t right, sorry. examples/js has been removed you can’t use https://threejs.org/examples/js/controls/OrbitControls.js anymore. Also please don’t use an older version since the general approach of importing such non-module files is deprecated.

Right now, there is no way to import/inject three.js addons like OrbitControls into editor scripts. The workaround is the modification of the published sources. Try the approach from javascript - How do you add controls from inside the three.js editor - Stack Overflow. But keep in mind that copy/pasting modules like that is not ideal.