Hello, I have two problems:
- When I rotate the camera to look at the painting, the camera gets overwritten by “scope.object.lookAt( scope.target );” in OrbitControls. Example below:
bugdemo
This is how I am currently rotating the camera and moving towards the position of the paintings (the commented lines are what I tried before and didn’t work):
// Moving towards painting
new TWEEN.Tween(positionCoords)
.to( { x: positionTo.x, y: positionTo.y, z: positionTo.z }, 1000 )
.easing( TWEEN.Easing.Quartic.In )
.onStart(() => {
// this.orbitControls.enabled = false;
})
.onUpdate(() => {
this.target.set(positionCoords.x, positionCoords.y, positionCoords.z);
})
.onComplete(() => {
// this.orbitControls.enabled = true;
})
.start();
// Rotate to look at the painting
new TWEEN.Tween(rotationCoords)
.to(to, 1000)
.easing(TWEEN.Easing.Quartic.In)
.onUpdate(() => {
// this.camera.rotation.set(
// rotationCoords.x,
// rotationCoords.y,
// rotationCoords.z,
// )
this.camera.rotation.z = rotationCoords.z;
this.camera.rotation.x = rotationCoords.x;
this.camera.rotation.y = rotationCoords.y;
})
.onComplete(() => {
// this.camera.position.set(positionCoords.x, positionCoords.y, positionCoords.z);
// this.target.set(positionCoords.x, positionCoords.y, positionCoords.z);
// this.orbitControls.enabled = true;
})
.start();
- I want to fit the painting to the center of the screen like below