Hi there, I've recently started using three.js and encountered some issues while trying to implement orbit controls. Despite its simplicity, I'm stuck on finding a solution for the errors I'm facing. When attempting to add controls like:
var controls = new THREE.OrbitControls(camera, renderer.domElement);
I encounter the following errors:
Cannot use import statement outside a module and THREE.OrbitControls is not a constructor
I made sure to include both Three.js and OrbitControls scripts before starting a new script. Can anyone point out what might be going wrong here?
<script src="scripts/three.js"></script>
<script src="scripts/OrbitControls.js"></script>
<script type="text/javascript">
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(75,window.innerWidth/window.innerHeight, 0.1, 1000);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setClearColor(0x888888,1)
document.body.appendChild(renderer.domElement);
var controls = new THREE.OrbitControls(camera, renderer.domElement);