frustum - Three.js, center camera to view all objects that is in the scene -


i write algorithm can explode (fold , unfold) mechanical set double clicking on then.

but want move camera backward or forward after see objects in fov. i'm trying use frustum calculate intersection between frustum , objects, don't undestand how use planes. i'm working orthographiccamera.

what :

  1. at every frame recalculate new frustum (when camera move):

    projscreenmatrix.multiplymatrices( camera.projectionmatrix, camera.matrixworldinverse ); frustum.setfrommatrix(projscreenmatrix); 
  2. then loop on 6 planes , bounding box of objects in scene :

    for (var = 0; < planes.length; i++) {         var plane = planes[i];         (var j = 0; j < boxs.length; j++) {             var box = boxs[j];             var line = new three.line3(box.min, nox.max);             //console.log({'plane': plane, 'line': line});             if (plane.isintersectionline(line))                 // move camera         }; }; 

but plane.isintersectionline(line) false.

do have ideas ?

thanks


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -