public function intersectsWith(AxisAlignedBB $bb) { if ($bb->maxX > $this->minX and $bb->minX < $this->maxX) { if ($bb->maxY > $this->minY and $bb->minY < $this->maxY) { return $bb->maxZ > $this->minZ and $bb->minZ < $this->maxZ; } } return false; }
/** * Checks for collision against an AxisAlignedBB * * @param AxisAlignedBB $bb * * @return bool */ public function collidesWithBB(AxisAlignedBB $bb) { $bb2 = $this->getBoundingBox(); return $bb2 !== null and $bb->intersectsWith($bb2); }