Merge with master branch
This commit is contained in:
@@ -11,9 +11,6 @@ void Systems::CollisionSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
transform->Position[0] += parentTransform->Position[0];
|
transform->Position[0] += parentTransform->Position[0];
|
||||||
transform->Position[1] += parentTransform->Position[1];
|
transform->Position[1] += parentTransform->Position[1];
|
||||||
transform->Position[2] += parentTransform->Position[2];
|
transform->Position[2] += parentTransform->Position[2];
|
||||||
<<<<<<< HEAD
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
auto collisionComponent = m_World->GetComponent<Components::Collision>(entity, "Collision");
|
auto collisionComponent = m_World->GetComponent<Components::Collision>(entity, "Collision");
|
||||||
@@ -26,7 +23,6 @@ void Systems::CollisionSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
// Quit out if we're not interested in collision events
|
// Quit out if we're not interested in collision events
|
||||||
if (!collisionComponent->Interested)
|
if (!collisionComponent->Interested)
|
||||||
return;
|
return;
|
||||||
>>>>>>> f76c0b336f87a259a7eabf3c532fc885f155a605
|
|
||||||
|
|
||||||
auto entities = m_World->GetEntities();
|
auto entities = m_World->GetEntities();
|
||||||
|
|
||||||
@@ -73,13 +69,16 @@ void Systems::CollisionSystem::Intersects(EntityID aEntity, EntityID bEntity)
|
|||||||
if(bCollisionComponent == nullptr)
|
if(bCollisionComponent == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
auto transformSystem = m_World->GetSystem<Systems::TransformSystem>("TransformSystem");
|
||||||
|
|
||||||
|
>>>>>>> b81d60799e242ee073f5fa8bf1996c8c5878db06
|
||||||
auto aBounds = m_World->GetComponent<Components::Bounds>(aEntity, "Bounds");
|
auto aBounds = m_World->GetComponent<Components::Bounds>(aEntity, "Bounds");
|
||||||
|
|
||||||
auto bBounds = m_World->GetComponent<Components::Bounds>(bEntity, "Bounds");
|
auto bBounds = m_World->GetComponent<Components::Bounds>(bEntity, "Bounds");
|
||||||
|
|
||||||
glm::vec3 aPos = aTransform->Position + (aBounds->Origin * aTransform->Scale);
|
glm::vec3 aPos = transformSystem->AbsolutePosition(aEntity) + (aBounds->Origin * aTransform->Scale);
|
||||||
glm::vec3 bPos = bTransform->Position + (bBounds->Origin * bTransform->Scale);
|
glm::vec3 bPos = transformSystem->AbsolutePosition(bEntity) + (bBounds->Origin * bTransform->Scale);
|
||||||
|
|
||||||
glm::vec3 aMax = aPos + aBounds->VolumeVector * aTransform->Scale;
|
glm::vec3 aMax = aPos + aBounds->VolumeVector * aTransform->Scale;
|
||||||
glm::vec3 aMin = aPos - aBounds->VolumeVector * aTransform->Scale;
|
glm::vec3 aMin = aPos - aBounds->VolumeVector * aTransform->Scale;
|
||||||
@@ -89,8 +88,8 @@ void Systems::CollisionSystem::Intersects(EntityID aEntity, EntityID bEntity)
|
|||||||
if (aMin.x <= bMax.x && bMin.x <= aMax.x) {
|
if (aMin.x <= bMax.x && bMin.x <= aMax.x) {
|
||||||
if (aMin.y <= bMax.y && bMin.y <= aMax.y) {
|
if (aMin.y <= bMax.y && bMin.y <= aMax.y) {
|
||||||
if (aMin.z <= bMax.z && bMin.z <= aMax.z) {
|
if (aMin.z <= bMax.z && bMin.z <= aMax.z) {
|
||||||
aCollisionComponent->CollidingEntities.push_back(aEntity);
|
aCollisionComponent->CollidingEntities.push_back(bEntity);
|
||||||
bCollisionComponent->CollidingEntities.push_back(bEntity);
|
bCollisionComponent->CollidingEntities.push_back(aEntity);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user