I am trying to smoothly move the OrbitControls(camera) in front of an object (face side) when a button is clicked using tween.js.
However, I encountered an issue where after changing the controls.target
and panning too far from the target object, I can only zoom in to a certain level and then I am unable to pan around the object.
Is there an alternative way to view an object? Thank you for any suggestions!
var from = {
x: controls.target.x,
y: controls.target.y,
z: controls.target.z
};
var to = {
x: object.getWorldPosition().x,
y: object.getWorldPosition().y,
z: object.getWorldPosition().z
};
var tween = new TWEEN.Tween(from)
.to(to, 1000)
.easing(TWEEN.Easing.Quadratic.InOut) // | TWEEN.Easing.Linear.None
.onUpdate(function () {
controls.target.set( this.x, this.y, this.z )
})
.onComplete(function () {
controls.target.set( this.x, this.y, this.z )
})
.start();