SeeOn
August 3, 2022, 12:25pm
1
I found out about this tool https://gltf.report/ by @donmccurdy
which is like on another level .
One of the most noticeable thing is for me was the smooth zoom with the Orbit control.
Does anyone have any clue how this could have been implemented.
Is there already a Library for It, or He is modifying scale value in Orbit control using some library function.
Thank you.
1 Like
Thanks @SeeOn !
I borrowed the camera controls code from the ModelViewer project β
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {property} from 'lit/decorators.js';
import {Event, PerspectiveCamera, Spherical, Vector3} from 'three';
import {style} from '../decorators.js';
import ModelViewerElementBase, {$ariaLabel, $container, $hasTransitioned, $loadedTime, $needsRender, $onModelLoad, $onResize, $renderer, $scene, $tick, $updateStatus, $userInputElement, toVector3D, Vector3D} from '../model-viewer-base.js';
This file has been truncated. show original
That code is a bit integrated with their project, not a standalone library, and so will take some adaptation. OrbitControls is easier to use and does have a βdampingβ property you could use to smooth it out.