当我使用透视相机检查点是否在截锥体内时,它可以工作。但是当我使用正交相机进行检查时,截锥体框显得不准确。平面设置正确。如果使用正交相机,我是否还有其他需要更改的东西?
这是我设置飞机的方式..
if((this.mouse.screenx>mouse.screen.x && this.mouse.screeny<mouse.screen.y)||
(this.mouse.screenx<mouse.screen.x && this.mouse.screeny>mouse.screen.y)){
topPlane.setFromCoplanarPoints(camera.position, topRight, topLeft );
rightPlane.setFromCoplanarPoints(camera.position, bottomRight, topRight );
bottomPlane.setFromCoplanarPoints(camera.position, bottomLeft,bottomRight );
leftPlane.setFromCoplanarPoints(camera.position, topLeft, bottomLeft );
}else{
topPlane.setFromCoplanarPoints(camera.position, topLeft , topRight );
rightPlane.setFromCoplanarPoints(camera.position, topRight , bottomRight );
bottomPlane.setFromCoplanarPoints(camera.position,bottomRight , bottomLeft );
leftPlane.setFromCoplanarPoints(camera.position, bottomLeft , topLeft );
}
nearPlane.setFromNormalAndCoplanarPoint(vector,camera.position);
vector.set( 0, 0, 1 );
vector.applyQuaternion( camera.quaternion );
var vector2 = new THREE.Vector3( 0, 0, -config.camera.far );
vector2.applyQuaternion( camera.quaternion );
vector2.add(camera.position);
farPlane.setFromNormalAndCoplanarPoint(vector,vector2);