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 );
};
console.log(orbitcontrols);
document.head.appendChild(orbitcontrols);
}
loadOrbitControls();
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.