Switch viewer 3D assiette de OrbitControls à TrackballControls
All checks were successful
Deploy / Deploy to Production (push) Successful in 11s
All checks were successful
Deploy / Deploy to Production (push) Successful in 11s
Permet la rotation libre sur tous les axes (y compris le roulis/Z), plus adapté à une pièce symétrique comme une assiette. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
33fbdfbb47
commit
09570f3ea8
1 changed files with 5 additions and 4 deletions
|
|
@ -325,7 +325,7 @@
|
|||
<script type="module">
|
||||
import * as THREE from 'three';
|
||||
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
|
||||
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
||||
import { TrackballControls } from 'three/addons/controls/TrackballControls.js';
|
||||
|
||||
const canvas = document.getElementById('viewer3d');
|
||||
const pholder = document.getElementById('viewer-placeholder');
|
||||
|
|
@ -353,9 +353,9 @@
|
|||
scene.add(fill);
|
||||
|
||||
// ── Controls ──────────────────────────────────────────
|
||||
const controls = new OrbitControls(camera, canvas);
|
||||
controls.enableDamping = true;
|
||||
controls.dampingFactor = 0.06;
|
||||
const controls = new TrackballControls(camera, canvas);
|
||||
controls.rotateSpeed = 3.0;
|
||||
controls.dynamicDampingFactor = 0.12;
|
||||
|
||||
// ── Model ─────────────────────────────────────────────
|
||||
let initCamPos, initTarget;
|
||||
|
|
@ -407,6 +407,7 @@
|
|||
camera.aspect = w / h;
|
||||
camera.updateProjectionMatrix();
|
||||
renderer.setSize(w, h);
|
||||
controls.handleResize();
|
||||
}
|
||||
resize();
|
||||
new ResizeObserver(resize).observe(viewer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue