Skip to content

Commit

Permalink
game_shared: trace: fixed calculations bug in SetupTrace
Browse files Browse the repository at this point in the history
  • Loading branch information
SNMetamorph committed Sep 2, 2023
1 parent 8f2acf7 commit 921dbef
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions game_shared/trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ void TraceMesh :: SetupTrace( const Vector &start, const Vector &mins, const Vec
memset( trace, 0, sizeof( *trace ));
trace->fraction = m_flRealFraction = 1.0f;
Vector lmins = mins, lmaxs = maxs, offset;
Vector adjustedStart, adjustedEnd;
float t, halfwidth, halfheight;
int i, total_signbits = 0;

Expand All @@ -119,8 +120,8 @@ void TraceMesh :: SetupTrace( const Vector &start, const Vector &mins, const Vec
offset[i] = ( mins[i] + maxs[i] ) * 0.5f;
lmins[i] = mins[i] - offset[i];
lmaxs[i] = maxs[i] - offset[i];
m_vecSrcStart[i] = start[i] + offset[i];
m_vecSrcEnd[i] = end[i] + offset[i];
adjustedStart[i] = start[i] + offset[i];
adjustedEnd[i] = end[i] + offset[i];
}

if (mins != maxs)
Expand All @@ -144,8 +145,8 @@ void TraceMesh :: SetupTrace( const Vector &start, const Vector &mins, const Vec
CheckAngles( m_vecAngles );

m_transform = matrix4x4( m_vecOrigin, Vector( m_vecAngles.x, m_vecAngles.y, m_vecAngles.z ), m_vecScale ).InvertFull();
m_vecStart = m_transform.VectorTransform( m_vecSrcStart );
m_vecEnd = m_transform.VectorTransform( m_vecSrcEnd );
m_vecStart = m_transform.VectorTransform( adjustedStart );
m_vecEnd = m_transform.VectorTransform( adjustedEnd );

if( mins != maxs )
{
Expand Down

0 comments on commit 921dbef

Please sign in to comment.