Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for swept box rays that were never really working properly with OBBs. (IntersectRayWithOBB) #590

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions mp/src/public/collisionutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1475,12 +1475,12 @@ 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 vecOBBExtents;
VectorAdd( vecOBBMins, vecOBBMaxs, vecOBBExtents );
vecOBBExtents *= 0.5f;

Vector vecOBBCenter;
VectorAdd( vecOBBMins, vecOBBMaxs, vecOBBCenter );
vecOBBCenter *= 0.5f;
vecOBBCenter.x += matOBBToWorld[0][3];
vecOBBCenter.y += matOBBToWorld[1][3];
vecOBBCenter.z += matOBBToWorld[2][3];
VectorTransform( vecOBBExtents, matOBBToWorld, vecOBBCenter );

Vector vecOBBHalfDiagonal;
VectorSubtract( vecOBBMaxs, vecOBBMins, vecOBBHalfDiagonal );
Expand Down
10 changes: 5 additions & 5 deletions sp/src/public/collisionutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1475,12 +1475,12 @@ 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 vecOBBExtents;
VectorAdd( vecOBBMins, vecOBBMaxs, vecOBBExtents );
vecOBBExtents *= 0.5f;

Vector vecOBBCenter;
VectorAdd( vecOBBMins, vecOBBMaxs, vecOBBCenter );
vecOBBCenter *= 0.5f;
vecOBBCenter.x += matOBBToWorld[0][3];
vecOBBCenter.y += matOBBToWorld[1][3];
vecOBBCenter.z += matOBBToWorld[2][3];
VectorTransform( vecOBBExtents, matOBBToWorld, vecOBBCenter );

Vector vecOBBHalfDiagonal;
VectorSubtract( vecOBBMaxs, vecOBBMins, vecOBBHalfDiagonal );
Expand Down