Basic collisions using Octree. Seems buggy over octree boundaries.

This commit is contained in:
2016-01-13 15:34:43 +01:00
parent 8ed4ba1219
commit d6ef527f25
33 changed files with 290 additions and 267 deletions
@@ -0,0 +1,20 @@
#include "Collision/CollidableOctreeSystem.h"
void CollidableOctreeSystem::Update(World* world, double dt)
{
m_Octree->ClearDynamicObjects();
}
void CollidableOctreeSystem::UpdateComponent(World* world, ComponentWrapper& cCollidable, double dt)
{
EntityID entity = cCollidable.EntityID;
if (world->HasComponent(entity, "AABB")) {
boost::optional<AABB> absoluteAABB = Collision::EntityAbsoluteAABB(world, entity);
if (absoluteAABB) {
m_Octree->AddDynamicObject(*absoluteAABB);
}
} else if (world->HasComponent(entity, "Model")) {
// TODO: Derive AABB from model
}
}