Skip to content

JonLim/three-trackballcontrols

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

three-trackballcontrols

NPM

Dependency Badge

A module for using TrackballControls for three.js with NodeJS.

Installation

npm install three-trackballcontrols or yarn add three-trackballcontrols

Usage

Example was using three.js + three-trackballcontrols inside of a very simple React app.

import * as THREE from 'three';
import TrackballControls from 'three-trackballcontrols';

// Assumes there is a `camera` and `renderer` initialized.
const controls = new TrackballControls(camera, renderer.domElement);

// Any manual camera changes should be done first, then update the controls.
camera.position.z = 5;
controls.update();

const animate = function () {
  requestAnimationFrame(animate);

  // Required for updating during animations.
  controls.update();
  renderer.render(scene, camera);
}
animate();

To-Dos

  • Support for further touch events