engine3d-dev / engine3d

Open-source game engine to be used for developing games
Apache License 2.0
1 stars 3 forks source link

AABB Trees #27

Open SpinnerX opened 1 month ago

SpinnerX commented 1 month ago

Overview

AABB Trees among other data structures are used in physics, which can take geometry data and be used for various things such as distance, collision detection, etc.

API Proposal

Note -- this proposal is still up for discussion on how we may want to do physics.

Something to consider in the thought process when coming up with physics API for engine3d. Is trying to separate specific common operations without the user relying on instantiating an object just to do a specific operation.

I want to do this only if that operation relies on that specific instantiation. What I mean when I say this is that if we need

#include <Core/Physics/AABB.h>
using namespace engine3d;

int main(){
        engine3d::physics::AABB player({pos, ...., n});
        engine3d::physics::AABB obstacle({pos2, ...., n});

        if(engine3d::physics::Collision(entity1, entity2)){
                 entity = old_position;
        }
}