A React renderer for Three.js that lets you build 3D scenes declaratively with JSX components.
yomotsu/camera-controls
A camera control library for three.js that adds smooth transitions and more features on top of OrbitControls-style orbiting.
- Stars
- 2,448
- Forks
- 300
- Open issues
- 104
- Last commit
- 18 days ago
What is it?
camera-controls is a TypeScript library for controlling a three.js camera with orbit rotation, dolly, and truck (pan) interactions, similar in spirit to THREE.OrbitControls. Its main addition is animated transitions: calls such as setLookAt, fitToBox, or rotateTo can move the camera smoothly over time, and these methods return Promises so transitions can be chained with await.
The library covers more than basic mouse and touch orbiting. It offers collision detection against meshes, boundary limits, focal offset, first-person and pointer-lock style movement, auto rotate, orthographic cameras, and configurable mouse and touch button mapping. It also emits events such as rest and sleep so an application can react when the camera stops moving.
Before creating an instance, the three.js objects must be passed in with CameraControls.install, and the update method must be called in the render loop. Interactive examples for many features are available on the project's documentation site.
Key features
- 01Smooth animated transitions for setLookAt, fitToBox, rotateTo and similar methods, with Promise support.
- 02Orbit, dolly, and truck controls with configurable mouse and touch mapping.
- 03Collision detection against meshes and boundary limits for the camera target.
- 04Support for perspective and orthographic cameras.
- 05Events such as rest and sleep for reacting when movement stops.
Use cases
- Building interactive 3D product viewers that fly to specific views or fit an object into the screen.
- Adding camera tours or scripted cinematic sequences chained with await.
- Creating first-person or third-person style navigation in a three.js scene with collision checks.
Quick start
- 1
Install three.js, which camera-controls requires; the README does not give an install command for either package
- 2
Import the library and register THREE with CameraControls.install before creating an instance
- 3
Create a CameraControls instance with your camera and DOM element, then call update(delta) in your animation loop
Things to know
- Requires three.js to be installed separately and registered via CameraControls.install, or it fails with runtime errors.
- Using colliderMeshes may decrease performance because collision tests use raycasters each frame.
Topics
FAQ
- What is camera-controls?
- A camera control library for three.js that adds smooth transitions and more features on top of OrbitControls-style orbiting. camera-controls is a TypeScript library for controlling a three.js camera with orbit rotation, dolly, and truck (pan) interactions, similar in spirit to THREE.OrbitControls. Its main addition is animated transitions: calls such as setLookAt, fitToBox, or rotateTo can move the camera smoothly over time, and these methods return Promises so transitions can be chained with await.
- Is camera-controls free to use? What license does it have?
- camera-controls is open source under the MIT license. Check the license terms before using it in commercial products.
- Is camera-controls still maintained?
- Actively maintained. The last commit to camera-controls was on Oct 21, 2026.
- What can I use camera-controls for?
- Building interactive 3D product viewers that fly to specific views or fit an object into the screen. Adding camera tours or scripted cinematic sequences chained with await. Creating first-person or third-person style navigation in a three.js scene with collision checks.
- How do I install camera-controls?
- Install three.js, which camera-controls requires; the README does not give an install command for either package Import the library and register THREE with CameraControls.install before creating an instance Create a CameraControls instance with your camera and DOM element, then call update(delta) in your animation loop
- Where can I get camera-controls?
- The source code and installation instructions are on GitHub: https://github.com/yomotsu/camera-controls
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Interactive 3D insect field guide where 63 species are modeled procedurally in the browser with TypeScript and Three.js, with no model files.
Browser-based previs studio for blocking scenes, posing characters, and cutting camera moves, then sending the shots to AI video models.
Eight agent skills that teach coding agents to build, animate and check 3D and scroll-driven websites with three.js.
A 3D Tetris game built with Three.js and React, playable in the browser.
A collection of ready-made React helper components and hooks for building 3D scenes with react-three-fiber.