diff --git a/mp/src/public/collisionutils.cpp b/mp/src/public/collisionutils.cpp index 6456e5b9..28e37952 100644 --- a/mp/src/public/collisionutils.cpp +++ b/mp/src/public/collisionutils.cpp @@ -1475,12 +1475,10 @@ bool IntersectRayWithOBB( const Ray_t &ray, const matrix3x4_t &matOBBToWorld, Collision_ClearTrace( ray.m_Start + ray.m_StartOffset, ray.m_Delta, pTrace ); // Compute a bounding sphere around the bloated OBB - Vector vecOBBCenter; - VectorAdd( vecOBBMins, vecOBBMaxs, vecOBBCenter ); - vecOBBCenter *= 0.5f; - vecOBBCenter.x += matOBBToWorld[0][3]; - vecOBBCenter.y += matOBBToWorld[1][3]; - vecOBBCenter.z += matOBBToWorld[2][3]; + Vector vecBoxExtents, vecOBBCenter; + VectorAdd( vecOBBMins, vecOBBMaxs, vecBoxExtents ); + vecBoxExtents *= 0.5f; + VectorTransform( vecBoxExtents, matOBBToWorld, vecOBBCenter ); Vector vecOBBHalfDiagonal; VectorSubtract( vecOBBMaxs, vecOBBMins, vecOBBHalfDiagonal ); diff --git a/sp/src/public/collisionutils.cpp b/sp/src/public/collisionutils.cpp index 9947b5bf..20d2f597 100644 --- a/sp/src/public/collisionutils.cpp +++ b/sp/src/public/collisionutils.cpp @@ -1475,12 +1475,10 @@ bool IntersectRayWithOBB( const Ray_t &ray, const matrix3x4_t &matOBBToWorld, Collision_ClearTrace( ray.m_Start + ray.m_StartOffset, ray.m_Delta, pTrace ); // Compute a bounding sphere around the bloated OBB - Vector vecOBBCenter; - VectorAdd( vecOBBMins, vecOBBMaxs, vecOBBCenter ); - vecOBBCenter *= 0.5f; - vecOBBCenter.x += matOBBToWorld[0][3]; - vecOBBCenter.y += matOBBToWorld[1][3]; - vecOBBCenter.z += matOBBToWorld[2][3]; + Vector vecBoxExtents, vecOBBCenter; + VectorAdd( vecOBBMins, vecOBBMaxs, vecBoxExtents ); + vecBoxExtents *= 0.5f; + VectorTransform( vecBoxExtents, matOBBToWorld, vecOBBCenter ); Vector vecOBBHalfDiagonal; VectorSubtract( vecOBBMaxs, vecOBBMins, vecOBBHalfDiagonal );