I'm having an issue with TrackballControls. It's not functioning properly and I can't figure out why. I'm following the example provided here: link to example. I've been searching for a solution but still can't seem to pinpoint what I'm doing wrong. Is there something missing in my code?
Simulation: link to my simulation
I have 2 TrackballControls.js because when I was looking for a solution, someone mentioned that adding the script via a URL helped in their case, rather than using a local file: link.
Code:
controls = new THREE.TrackballControls( camera );
controls.rotateSpeed = 1.0;
controls.zoomSpeed = 1.2;
controls.panSpeed = 0.8;
controls.noZoom = false;
controls.noPan = false;
controls.staticMoving = true;
controls.dynamicDampingFactor = 0.3;
controls.keys = [ 65, 83, 68 ];
controls.addEventListener( 'change', render );`
Then, in the next update function animate:
function animate() {
controls.update();
}
Finally, the animate function is called in the loader:
loader.load('./models/my_pc/models/my_pc.dae', function (collada) {
model = collada.scene;
model.scale.x = model.scale.y = model.scale.z = 0.0125;
model.position.x = -2;
model.position.y = 0;
model.position.z = 2;
model.rotation.x = -1.570796327;
model.rotation.y = 0;
model.rotation.z = 0;
init();
animate();
}