I'm currently facing a challenge in breaking down my threejs project into smaller modules. One specific function that I'm struggling with is the following:
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;
};
})();
If I wanted to separate this updateCamera function into its own file and import it, I'm unsure of how to proceed due to it being self-executing. Can anyone provide assistance?