https://github.com/repalash/offsetorbitcontrols
Modified three.js OrbitControls with target offset.
https://github.com/repalash/offsetorbitcontrols
Last synced: 3 months ago
JSON representation
Modified three.js OrbitControls with target offset.
- Host: GitHub
- URL: https://github.com/repalash/offsetorbitcontrols
- Owner: repalash
- Created: 2022-05-21T08:32:43.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-21T08:38:29.000Z (about 4 years ago)
- Last Synced: 2025-01-17T10:12:10.786Z (over 1 year ago)
- Language: HTML
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# OffsetOrbitControls
Small extension to OrbitControls to allow for offsetting the target position on screen.
This is useful for zooming and rotating around an arbitrary point on the screen to create model viewers with offset on screen.
It also allows for panning around without changing the target position.
Live Demo: [https://repalash.com/OffsetOrbitControls/](https://repalash.com/OffsetOrbitControls/)
To use replace `OrbitControls` with `OffsetOrbitControls` and call `controls.update()` in the render loop. see `index.html`
To reset the target or to set the offset on the screen, set `controls.targetOffset.set(x, y, 0)` in screen space NDC.
To fix the target offset on screen, disable panning by doing `controls.enablePan = false`