I'm trying to break my threejs project into smaller modules and I'm having a tough time. Take this function for example:
var updateCamera = (function() {
var euler = new THREE.Euler( 0, 0, 0, 'YXZ' );
return function() {
euler.x = motion.rotation.x;
euler.y = motion.rotation.y;
camera.quaternion.setFromEuler( euler );
camera.position.copy( motion.position );
camera.position.y += 10.0;
};
})();
Lets say I wanted to break this updateCamera function into its own file and import it. I'm a bit confused on how to since it's self executing. Can anyone give me a hand?