refactor: modernize AABB class

This commit is contained in:
orng
2026-03-27 21:11:11 -05:00
parent da7cbcb4b6
commit 79217ca8e3
53 changed files with 362 additions and 357 deletions

View File

@@ -147,8 +147,9 @@ void Throwable::tick() {
if (!level->isClientSide) {
std::shared_ptr<Entity> hitEntity = nullptr;
std::vector<std::shared_ptr<Entity> >* objects = level->getEntities(
shared_from_this(), bb->expand(xd, yd, zd)->grow(1, 1, 1));
AABB grown = bb->expand(xd, yd, zd).grow(1, 1, 1);
std::vector<std::shared_ptr<Entity> >* objects =
level->getEntities(shared_from_this(), &grown);
double nearest = 0;
std::shared_ptr<LivingEntity> owner = getOwner();
for (int i = 0; i < objects->size(); i++) {
@@ -156,8 +157,8 @@ void Throwable::tick() {
if (!e->isPickable() || (e == owner && flightTime < 5)) continue;
float rr = 0.3f;
AABB* bb = e->bb->grow(rr, rr, rr);
HitResult* p = bb->clip(&from, &to);
AABB bb = e->bb->grow(rr, rr, rr);
HitResult* p = bb.clip(from, to);
if (p != NULL) {
double dd = from.distanceTo(p->pos);
delete p;