export controls

This commit is contained in:
2023-07-06 19:42:30 +02:00
parent a2dc4678c8
commit 59158d68b8
6 changed files with 33 additions and 22 deletions

View File

@ -74,7 +74,7 @@ class Stats {
}
get time() {
return this.clock.timeFormat.format(this.clock.elapsedTime * 1000)
return this.clock.timeFormat.format(this.clock.getElapsedTime() * 1000)
}
lockDown(nbClearedLines, tSpin) {

24
jsm/TetraControls.js Normal file
View File

@ -0,0 +1,24 @@
import { OrbitControls } from 'three/addons/controls/OrbitControls.js'
class TetraControls extends OrbitControls {
constructor(camera, domElement) {
super(camera, domElement)
this.autoRotate
this.enableDamping = true
this.dampingFactor = 0.04
this.maxDistance = 21
this.keys = {}
this.minPolarAngle = 0.9
this.maxPolarAngle = 2.14
this.minAzimuthAngle = 0.9 - Math.PI / 2
this.maxAzimuthAngle = 2.14 - Math.PI / 2
this.target.set(5, 9, 0)
this.addEventListener("start", () => domElement.style.cursor = "grabbing")
this.addEventListener("end", () => domElement.style.cursor = "grab")
}
}
export { TetraControls }