diff --git a/SHADE_Engine/src/Physics/Collision/Narrowphase/SHSphereVsConvex.cpp b/SHADE_Engine/src/Physics/Collision/Narrowphase/SHSphereVsConvex.cpp index 4ced77d7..68217d8b 100644 --- a/SHADE_Engine/src/Physics/Collision/Narrowphase/SHSphereVsConvex.cpp +++ b/SHADE_Engine/src/Physics/Collision/Narrowphase/SHSphereVsConvex.cpp @@ -238,7 +238,7 @@ namespace SHADE // Build plane equation // Use first vertex to build the plane - const SHPlane FACE_PLANE { polyhedron.GetVertex(FACE.vertexIndices[0].index), -polyhedron.GetNormal(i) }; + const SHPlane FACE_PLANE { polyhedron.GetVertex(FACE.vertexIndices[0].index), polyhedron.GetNormal(i) }; // Find signed distance of center to plane const float SIGNED_DIST = FACE_PLANE.SignedDistance(CENTER); diff --git a/SHADE_Engine/src/Physics/Dynamics/SHContactManager.cpp b/SHADE_Engine/src/Physics/Dynamics/SHContactManager.cpp index 54fc531c..43a904f6 100644 --- a/SHADE_Engine/src/Physics/Dynamics/SHContactManager.cpp +++ b/SHADE_Engine/src/Physics/Dynamics/SHContactManager.cpp @@ -52,16 +52,11 @@ namespace SHADE , .normal = manifold.normal }; - const auto* SHAPE_B = manifold.shapeB; - const SHCollisionUtils::ShapeTransform TF_B = { SHAPE_B->GetWorldCentroid(), SHAPE_B->GetWorldOrientation() }; + const auto* SHAPE_A = manifold.shapeA; + const SHCollisionUtils::ShapeTransform TF_A = { SHAPE_A->GetWorldCentroid(), SHAPE_A->GetWorldOrientation() }; for (uint32_t i = 0; i < manifold.numContacts; ++i) - { - const SHVec3 WORLD_POINT_A = TF_B * manifold.contacts[i].localPointA; - const SHVec3 WORLD_POINT_B = TF_B * manifold.contacts[i].localPointB; - - collisionEvent.contactPoints[i] = WORLD_POINT_A; - } + collisionEvent.contactPoints[i] = TF_A * manifold.contacts[i].localPointA; collisionEvents.emplace_back(collisionEvent); } @@ -84,13 +79,11 @@ namespace SHADE const auto* SHAPE_B = manifold.shapeB; const SHCollisionUtils::ShapeTransform TF_A = { SHAPE_A->GetWorldCentroid(), SHAPE_A->GetWorldOrientation() }; - const SHCollisionUtils::ShapeTransform TF_B = { SHAPE_B->GetWorldCentroid(), SHAPE_B->GetWorldOrientation() }; for (uint32_t i = 0; i < manifold.numContacts; ++i) { - // Contact position will be the middle of worldPointA & worldPointB - const SHVec3 WORLD_POINT_A = TF_B * manifold.contacts[i].localPointA; - const SHVec3 WORLD_POINT_B = TF_B * manifold.contacts[i].localPointB; + // Contact position will be world pont + const SHVec3 WORLD_POINT_A = TF_A * manifold.contacts[i].localPointA; const ContactInfo INFO {