add beginning of visualization for statistics, unmodified from blog code

This commit is contained in:
2023-05-16 06:22:19 -06:00
parent fb7d51ac4c
commit a9844e6e78
17 changed files with 461 additions and 3 deletions

View File

@@ -0,0 +1,36 @@
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
import { MathUtils } from "three";
function createControls(camera, canvas) {
const controls = new OrbitControls(camera, canvas);
//enable controls?
controls.enabled = true;
controls.autoRotate = true;
controls.autoRotateSpeed = 0.2;
// control limits
// It's recommended to set some control boundaries,
// to prevent the user from clipping with the objects.
// y axis
controls.minPolarAngle = MathUtils.degToRad(40); // default
controls.maxPolarAngle = MathUtils.degToRad(75);
// x axis
// controls.minAzimuthAngle = ...
// controls.maxAzimuthAngle = ...
//smooth camera:
// remember to add to loop updatables to work
controls.enableDamping = true;
controls.enableZoom = false;
controls.enablePan = false;
controls.tick = () => controls.update();
return controls;
}
export { createControls };