Hi, Here I have implement Tween js when I click an object. However, what happened is camera exactly on the selected object position. What I want is camera zooming to object (centering) and camera look also point to the object.
this.control.enabled = false;
const coord = {
x: this.camera.position.x,
y: this.camera.position.y,
z: this.camera.position.z,
};
new Tween(coord)
.to({
x: this.pickedObject.position.x,
y: this.pickedObject.position.y + 2,
z: this.pickedObject.position.z,
})
.easing(Easing.Quadratic.Out)
.onUpdate(() => {
this.camera.position.set(coord.x, coord.y, coord.z);
})
.onComplete(() => {
this.control.enabled = true;
this.control.update();
})
.start();