AABBs are auto attached when adding Trigger/Collideable/etc, also added AttachComponent method to ComponentWrapper.

This commit is contained in:
William Moberg
2016-02-08 14:34:37 +01:00
parent 11cf85cc73
commit 93c6f3c0a3
7 changed files with 42 additions and 27 deletions
+8 -6
View File
@@ -7,12 +7,14 @@ void FillOctreeSystem::Update(double dt)
void FillOctreeSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt)
{
if (entity.HasComponent("AABB")) {
boost::optional<EntityAABB> absoluteAABB = Collision::EntityAbsoluteAABB(entity);
if (absoluteAABB) {
m_Octree->AddDynamicObject(*absoluteAABB);
if (!entity.HasComponent("AABB")) {
//Derive AABB from model.
if (!Collision::AttachAABBComponentFromModel(entity)) {
return;
}
} else if (entity.HasComponent("Model")) {
// TODO: Derive AABB from model
}
boost::optional<EntityAABB> absoluteAABB = Collision::EntityAbsoluteAABB(entity);
if (absoluteAABB) {
m_Octree->AddDynamicObject(*absoluteAABB);
}
}