Tiny logic alteration so we don't get false warnings in debug.

This commit is contained in:
William Moberg
2016-01-19 16:59:02 +01:00
parent 017ad96bbe
commit d1b6fb1259
+6 -3
View File
@@ -34,9 +34,12 @@ void TriggerSystem::UpdateComponent(World* world, EntityWrapper& entity, Compone
throwLeaveIfWasInTrigger(m_EntitiesCompletelyInTrigger[tId], pId, tId); throwLeaveIfWasInTrigger(m_EntitiesCompletelyInTrigger[tId], pId, tId);
} else { } else {
//Entity is at least touching the trigger. //Entity is at least touching the trigger.
AABB completelyInsideBox = AABB::FromOriginSize((*triggerBox).Origin(), (*triggerBox).Size() - 2.0f * (*playerBox).Size()); AABB completelyInsideBox;
if (Collision::AABBVsAABB(completelyInsideBox, *playerBox) && bool playerFitsInTrigger = glm::all(glm::greaterThan((*triggerBox).Size(), (*playerBox).Size()));
glm::all(glm::greaterThan((*triggerBox).Size(), (*playerBox).Size()))) { if (playerFitsInTrigger) {
completelyInsideBox = AABB::FromOriginSize((*triggerBox).Origin(), (*triggerBox).Size() - 2.0f * (*playerBox).Size());
}
if (playerFitsInTrigger && Collision::AABBVsAABB(completelyInsideBox, *playerBox)) {
//Entity is completely inside the trigger. //Entity is completely inside the trigger.
//If it was only touching before, it is erased. //If it was only touching before, it is erased.
m_EntitiesTouchingTrigger[tId].erase(pId); m_EntitiesTouchingTrigger[tId].erase(pId);