[GIS] How to update Trackball controls at three js

qgisthree-js

I have a project at three.js created from qgis to threejs export where i need to update the trackball controls on window resize.. I need to do that updating the whole controls calling the function with new input variables. Recreating the controls causes crash and i dont want to delete the controls and create new one cause of the garbage this might cause. I have a similar question https://stackoverflow.com/questions/28577347/how-to-update-createcontrolss-function-input-variables-at-javascript but i think this is more complete question.

Best Answer

This can be done with the handleResize() method inside TrackballControls. Just add :

function resize(){
    //camera stuff, renderer resize.. and
    controls.handleResize();
}
Related Question