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[1] += parentTransform->Position[1];
|
||||
transform->Position[2] += parentTransform->Position[2];
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}*/
|
||||
|
||||
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
|
||||
if (!collisionComponent->Interested)
|
||||
return;
|
||||
>>>>>>> f76c0b336f87a259a7eabf3c532fc885f155a605
|
||||
|
||||
auto entities = m_World->GetEntities();
|
||||
|
||||
@@ -73,13 +69,16 @@ void Systems::CollisionSystem::Intersects(EntityID aEntity, EntityID bEntity)
|
||||
if(bCollisionComponent == nullptr)
|
||||
return;
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
auto transformSystem = m_World->GetSystem<Systems::TransformSystem>("TransformSystem");
|
||||
|
||||
>>>>>>> b81d60799e242ee073f5fa8bf1996c8c5878db06
|
||||
auto aBounds = m_World->GetComponent<Components::Bounds>(aEntity, "Bounds");
|
||||
|
||||
auto bBounds = m_World->GetComponent<Components::Bounds>(bEntity, "Bounds");
|
||||
|
||||
glm::vec3 aPos = aTransform->Position + (aBounds->Origin * aTransform->Scale);
|
||||
glm::vec3 bPos = bTransform->Position + (bBounds->Origin * bTransform->Scale);
|
||||
glm::vec3 aPos = transformSystem->AbsolutePosition(aEntity) + (aBounds->Origin * aTransform->Scale);
|
||||
glm::vec3 bPos = transformSystem->AbsolutePosition(bEntity) + (bBounds->Origin * bTransform->Scale);
|
||||
|
||||
glm::vec3 aMax = 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.y <= bMax.y && bMin.y <= aMax.y) {
|
||||
if (aMin.z <= bMax.z && bMin.z <= aMax.z) {
|
||||
aCollisionComponent->CollidingEntities.push_back(aEntity);
|
||||
bCollisionComponent->CollidingEntities.push_back(bEntity);
|
||||
aCollisionComponent->CollidingEntities.push_back(bEntity);
|
||||
bCollisionComponent->CollidingEntities.push_back(aEntity);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -123,7 +122,7 @@ void Systems::CollisionSystem::CreateBoundingBox(std::shared_ptr<Components::Bou
|
||||
GLushort elements[] = {
|
||||
0, 1, 2, 3,
|
||||
4, 5, 6, 7,
|
||||
0, 4, 1, 5,
|
||||
0, 4, 1, 5,
|
||||
2, 6, 3, 7
|
||||
};
|
||||
GLuint ibo_elements;
|
||||
|
||||
Reference in New Issue
Block a user