|
1 | | -import { TilesRenderer } from '3d-tiles-renderer'; |
| 1 | +import { TilesRenderer, EnvironmentControls } from '3d-tiles-renderer'; |
2 | 2 | import { DebugTilesPlugin } from '3d-tiles-renderer/plugins'; |
3 | 3 | import { |
4 | 4 | Scene, |
|
9 | 9 | Group, |
10 | 10 | FogExp2, |
11 | 11 | } from 'three'; |
12 | | -import { FlyOrbitControls } from './src/controls/FlyOrbitControls.js'; |
13 | 12 | import { GUI } from 'three/examples/jsm/libs/lil-gui.module.min.js'; |
14 | 13 |
|
15 | 14 | let camera, controls, scene, renderer; |
@@ -42,15 +41,12 @@ function init() { |
42 | 41 |
|
43 | 42 | camera = new PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 4000 ); |
44 | 43 | camera.position.set( 20, 10, 20 ); |
| 44 | + camera.lookAt( 0, 0, 0 ); |
45 | 45 |
|
46 | 46 | // controls |
47 | | - controls = new FlyOrbitControls( camera, renderer.domElement ); |
48 | | - controls.screenSpacePanning = false; |
49 | | - controls.minDistance = 1; |
50 | | - controls.maxDistance = 2000; |
51 | | - controls.maxPolarAngle = Math.PI / 2; |
52 | | - controls.baseSpeed = 0.1; |
53 | | - controls.fastSpeed = 0.2; |
| 47 | + controls = new EnvironmentControls( scene, camera, renderer.domElement ); |
| 48 | + controls.minZoomDistance = 2; |
| 49 | + controls.cameraRadius = 1; |
54 | 50 |
|
55 | 51 | // lights |
56 | 52 | const dirLight = new DirectionalLight( 0xffffff ); |
@@ -107,6 +103,7 @@ function render() { |
107 | 103 |
|
108 | 104 | requestAnimationFrame( render ); |
109 | 105 |
|
| 106 | + controls.update(); |
110 | 107 | camera.updateMatrixWorld(); |
111 | 108 |
|
112 | 109 | groundTiles.errorTarget = params.errorTarget; |
|
0 commit comments