Currently working on my 3D project using three.js and everything is running smoothly on my laptop. I'm utilizing OrbitControls
for camera movement, but I have disabled right-click panning to only allow camera rotation. However, when testing on a mobile device (iPhone), using two fingers allows me to move the camera instead of just rotating it. Is there a way to prevent this behavior on mobile devices?
this.controls = new OrbitControls(this.camera, this.renderer.domElement)
this.controls.enableDamping = true
this.controls.maxPolarAngle = Math.PI * 0.45
this.controls.mouseButtons = {
LEFT: THREE.MOUSE.ROTATE,
MIDDLE: THREE.MOUSE.DOLLY,
RIGHT: ''
}
Update function:
_RAF() {
requestAnimationFrame(() => {
this.water.material.uniforms[ 'time' ].value += 1.0 / 60.0
this.controls.maxDistance = 10000.0
this.controls.minDistance = 10.0
this.controls.update()
this.camera.updateProjectionMatrix()
this.renderer.render(this.scene, this.camera)
this._RAF()
})
}