Fixed bullet diameter hitbox test

This commit is contained in:
Kamay Xutax 2024-07-15 23:27:31 +02:00
parent 466b0ea280
commit 6661ad2e3c
4 changed files with 9 additions and 16 deletions

View file

@ -470,10 +470,6 @@ bool CEngineTrace::ClipRayToHitboxes( const Ray_t& ray, unsigned int fMask, ICol
VectorAdd( ray.m_Start, ray.m_StartOffset, hitboxTrace.startpos );
VectorAdd( hitboxTrace.startpos, ray.m_Delta, hitboxTrace.endpos );
// At the moment, it has to be a true ray to work with hitboxes
if ( !ray.m_IsRay )
return false;
// If the hitboxes weren't even tested, then just use the original trace
if (!pCollideable->TestHitboxes( ray, fMask, hitboxTrace ))
return false;
@ -1348,7 +1344,7 @@ ICollideable *CEngineTraceServer::GetWorldCollideable()
//-----------------------------------------------------------------------------
void EngineTraceRenderRayCasts()
{
#if defined _DEBUG && !defined SWDS
#if defined _DEBUG
if( debugrayenable.GetBool() && s_FrameRays.Count() > debugraylimit.GetInt() && !debugrayreset.GetInt() )
{
Warning( "m_FrameRays.Count() == %d\n", s_FrameRays.Count() );
@ -1660,7 +1656,7 @@ CON_COMMAND_EXTERN( ray_bench, RayBench, "Time the rays" )
//-----------------------------------------------------------------------------
void CEngineTrace::TraceRay( const Ray_t &ray, unsigned int fMask, ITraceFilter *pTraceFilter, trace_t *pTrace )
{
#if defined _DEBUG && !defined SWDS
#if defined _DEBUG
if( debugrayenable.GetBool() )
{
s_FrameRays.AddToTail( ray );

View file

@ -3350,7 +3350,7 @@ void _Host_RunFrame (float time)
else
{
g_ClientGlobalVariables.interpolation_amount = 0.0f;
#ifdef _DEBUG
#ifdef false
printf("interpolation amount was %f, corrected to "
"fix interpolation issues.\n",
cl.m_tickRemainder
@ -3475,7 +3475,7 @@ void _Host_RunFrame (float time)
else
{
g_ClientGlobalVariables.interpolation_amount = 0.0f;
#ifdef _DEBUG
#ifdef false
printf("interpolation amount was %f, corrected to "
"fix interpolation issues.\n",
cl.m_tickRemainder

View file

@ -5064,10 +5064,6 @@ bool C_BaseAnimating::TestHitboxes( const Ray_t &ray, unsigned int fContentsMask
if ( !set || !set->numhitboxes )
return false;
// Use vcollide for box traces.
if ( !ray.m_IsRay )
return false;
// This *has* to be true for the existing code to function correctly.
Assert( ray.m_StartOffset == vec3_origin );

View file

@ -1490,9 +1490,10 @@ bool IntersectRayWithOBB( const Ray_t &ray, const matrix3x4_t &matOBBToWorld,
VectorSubtract( vecOBBMaxs, vecOBBMins, vecOBBHalfDiagonal );
vecOBBHalfDiagonal *= 0.5f;
float flRadius = vecOBBHalfDiagonal.Length() + ray.m_Extents.Length();
if ( !IsRayIntersectingSphere( ray.m_Start, ray.m_Delta, vecOBBCenter, flRadius, flTolerance ) )
return false;
// TODO_ENHANCED: make sphere hitboxes.
// float flRadius = vecOBBHalfDiagonal.Length() + ray.m_Extents.Length();
// if ( !IsRayIntersectingSphere( ray.m_Start, ray.m_Delta, vecOBBCenter, flRadius, flTolerance ) )
// return false;
// Ok, we passed the trivial reject, so lets do the dirty deed.
// Basically we're going to do the GJK thing explicitly. We'll shrink the ray down
@ -1670,7 +1671,7 @@ bool IntersectRayWithOBB( const Ray_t &ray, const matrix3x4_t &matOBBToWorld,
}
temp.type = 3;
MatrixITransformPlane( matOBBToWorld, temp, pTrace->plane );
MatrixTransformPlane( matOBBToWorld, temp, pTrace->plane );
return true;
}