threejs 判断对象是否在视野范围内


let tempV = vector.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix);

if ( (Math.abs(tempV.x) > 1) || (Math.abs(tempV.y) > 1) || (Math.abs(tempV.z) > 1) ) {
// 在视野外了
} else {
// 在视野内
}

posted @ 2019-12-10 15:38  码农拔萝卜  阅读(1988)  评论(4)    收藏  举报