I've been troubleshooting this issue for hours, but I can't seem to figure out the error...
Here's the error message I'm getting:
Cannot read property 'add' of undefined
Below is my coffeescript code file (hopefully it's readable) with the main function at the end:
class _3D_Engine_
constructor: () ->
// define all necessary constants
@STATS_ENABLED = true
@divBackgroundColor = '#D7F0F7'
@cameraInitPos = new THREE.Vector3(10, 10, 10)
... (more constants defined)
setUpWorld: () ->
if @sceneLoaded() is false
@setUpScene()
if @sceneLoaded() is true
@setUpCamera()
@setUpRenderer()
@setUpClock()
@setUpControls()
@setUpStats()
@setUpLights()
@setUpShadows()
@setUpFog()
$("#loading").hide()
document.body.appendChild(@renderer.domElement)
document.body.appendChild(@stats.domElement)
@animate()
... (more function definitions)
_3D_Engine_.prototype.animate = function() {
this.renderer.render(this.scene, this.camera);
this.stats.update();
this.controls.update(this.clock.getDelta());
return requestAnimationFrame(this.animate());
};
...
this.main = function() {
this._3D_Engine = new _3D_Engine_();
this._3D_Engine.setUpWorld();
return this._3D_Engine.animate();
};
The same code compiled to javascript:
// Generated by CoffeeScript 1.7.1
...