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
+4
View File
@@ -6,6 +6,10 @@
void TriggerSystem::UpdateComponent(EntityWrapper& triggerEntity, ComponentWrapper& cTrigger, double dt)
{
// The trigger *should* have a bounding box, or something, to test against so it can be triggered.
// If it doesn't, add one as big as the model for now, then size can be modified in editor if necessary.
if (!triggerEntity.HasComponent("AABB")) {
Collision::AttachAABBComponentFromModel(triggerEntity);
}
boost::optional<EntityAABB> triggerBox = Collision::EntityAbsoluteAABB(triggerEntity);
if (!triggerBox) {
return;