Every time I try to create a TrackballControls object, I encounter an error message stating "THREE.TrackballControls is not a constructor".
Here's a simple example:
<!doctype html>
<html>
<head>
<title>Trackball Controls</title>
</head>
<body>
<script src = "three.js"></script>
<scirpt src = "TrackballControls.js"></script>
<script>
var width = 640;
var height = 480;
var renderer = new THREE.WebGLRenderer();
renderer.setSize(width, height);
document.body.appendChild(renderer.domElement);
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(50, width / height, 0.1, 10000);
scene.add(camera);
//controls
var trackballControls = new THREE.TrackballControls(camera);
</script>
</body>
</html>
The reference for the three.js file is in three.js-master\build
and TrackballControls.js can be found in
three.js-master\examples\js\controls
.
What could be causing this error and how do I go about resolving it?