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 :
at every frame recalculate new frustum (when camera move):
projscreenmatrix.multiplymatrices( camera.projectionmatrix, camera.matrixworldinverse ); frustum.setfrommatrix(projscreenmatrix);
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
Post a Comment