Currently, I am working on a project using Ruby on Rails and incorporating three.js. I have successfully installed the corresponding gem, and everything appears to be functioning properly. However, an error is being thrown in the JavaScript:
Uncaught ReferenceError: THREE is not defined
This error occurs on the following line:
renderer = new THREE.WebGLRenderer();
Strangely enough, despite this error, my program is displaying the object as intended.
Here is a snippet of my JavaScript file:
// set size to the size of the containing box
var box = document.getElementById('player');
if(box){
var boxSize = box.clientWidth;
}
var a = 0.05;
// set some camera attributes
var VIEW_ANGLE = 45,
ASPECT = 1,
NEAR = 0.1,
FAR = 10000;
var camera, scene, renderer;
var $player;
var char, materialChar ;
// additional code here...