the problem is I have a model and orbitControls, but my model and the camera has animations.
So I struggling to find a way to full dispose the orbitcontrols before a camera animation start and then reenable the orbitcontrols when the camera animatin has finish.
this what I have tried without success:
this.controls = new OrbitControls(this.camera, this._ELEMENT);
---------------------------- I use this little function before each camera animation
animationWillStart()
{
this.controls.dispose();
this.controls.enabled=false;
}
Both just stop any user interaction but the orbitcontrols still working and affecting the animation of the camera (the camera moves but keeps observing the orbit point).
before use dispose(), I was only using “enabled=false;” then I realice that “enabled” only stop user inputs but the orbitcontrols still
working. So when I load a camera animation using the AnimatorMixer, orbitcontrols still chaining the camera to the orbit target
instead of let the camera be complete free.
Thats why I thought on using dispose(). But not even dispose() work and I guessing is because dispose() stops the event listener but doesnt remove the orbit target. So the result is the same (any camera animation is executed but keeping (observing) the orbit target
instead of being completely free).
the only way I could find to kill Orbitcontrols and thus completely free the camera is doing something like: “this.controls=null”.
Succes. now the camera animations works as they should, but the problem is reenable orbitcontrols again after the camera animation has finished. If I try create it again
Are you manually call controls.update() in the animation loop? Notice that this is only necessary if you are enabling damping. Besides, try to not call the method when the controls are disabled.
As mentioned in the documentation the enabled only decides whether the controls respond to user input or not. If you call update(), the camera will be updated.