A simple orbit control for the 3.js library
This project is a simple orbit controller written in JavaScript for the Three.js library, which allows the user to "rotate" (the camera is actually orbiting) the object by clicking and dragging the mouse anywhere in the Three.js renderer element. This repo contains the OrbitControl.js file as well as a sample scene demonstrating how it works.
This project requires Three.js
Add the OrbitControl.js file to your project, then instantiate a new rotationControls object:
scene = new THREE.Scene();
camera = new THREE.Camera();
renderer = new THREE.WebGLRenderer({antialias: true});
var orbitControl = new rotationControls(scene, camera, renderer, document);
orbitControl.Add()
//the scene will now rotate with a mouse click and drag