该方法用于检测当前OrientedBox与传入的另一个Box是否相交。
intersectsBox(box: Box3): boolean;
import { Box3, Euler, Vector3 } from "three";
import { OrientedBox } from "three-bvh-mesh";
const ob1 = new OrientedBox(new Vector3(0, 0, 0), new Vector3(1, 1, 1), new Euler(0, 0, 0));
const ob2 = new OrientedBox(new Vector3(1, 1, 1), new Vector3(2, 2, 2), new Euler(0, 0, 0));
const box1 = new Box3(new Vector3(0, 0, 0), new Vector3(1, 1, 1));
const box2 = new Box3(new Vector3(1, 1, 1), new Vector3(2, 2, 2));
console.log(ob1.intersectsBox(box1)); // true
console.log(ob2.intersectsBox(box1)); // false
console.log(ob2.intersectsBox(box2)); // true
以上示例中,我们实例化了两个OrientedBox和两个Box3,并进行了多次检测。第一次检测ob1与box1相交,所以返回true;第二次检测ob2与box1不相交,返回false;第三次检测ob2与box2相交,返回true。