Fixed bullet diameter hitbox test
This commit is contained in:
parent
941a5f5b6d
commit
22fc06498f
4 changed files with 9 additions and 16 deletions
|
@ -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( ray.m_Start, ray.m_StartOffset, hitboxTrace.startpos );
|
||||||
VectorAdd( hitboxTrace.startpos, ray.m_Delta, hitboxTrace.endpos );
|
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 the hitboxes weren't even tested, then just use the original trace
|
||||||
if (!pCollideable->TestHitboxes( ray, fMask, hitboxTrace ))
|
if (!pCollideable->TestHitboxes( ray, fMask, hitboxTrace ))
|
||||||
return false;
|
return false;
|
||||||
|
@ -1348,7 +1344,7 @@ ICollideable *CEngineTraceServer::GetWorldCollideable()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void EngineTraceRenderRayCasts()
|
void EngineTraceRenderRayCasts()
|
||||||
{
|
{
|
||||||
#if defined _DEBUG && !defined SWDS
|
#if defined _DEBUG
|
||||||
if( debugrayenable.GetBool() && s_FrameRays.Count() > debugraylimit.GetInt() && !debugrayreset.GetInt() )
|
if( debugrayenable.GetBool() && s_FrameRays.Count() > debugraylimit.GetInt() && !debugrayreset.GetInt() )
|
||||||
{
|
{
|
||||||
Warning( "m_FrameRays.Count() == %d\n", s_FrameRays.Count() );
|
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 )
|
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() )
|
if( debugrayenable.GetBool() )
|
||||||
{
|
{
|
||||||
s_FrameRays.AddToTail( ray );
|
s_FrameRays.AddToTail( ray );
|
||||||
|
|
|
@ -3350,7 +3350,7 @@ void _Host_RunFrame (float time)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_ClientGlobalVariables.interpolation_amount = 0.0f;
|
g_ClientGlobalVariables.interpolation_amount = 0.0f;
|
||||||
#ifdef _DEBUG
|
#ifdef false
|
||||||
printf("interpolation amount was %f, corrected to "
|
printf("interpolation amount was %f, corrected to "
|
||||||
"fix interpolation issues.\n",
|
"fix interpolation issues.\n",
|
||||||
cl.m_tickRemainder
|
cl.m_tickRemainder
|
||||||
|
@ -3475,7 +3475,7 @@ void _Host_RunFrame (float time)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_ClientGlobalVariables.interpolation_amount = 0.0f;
|
g_ClientGlobalVariables.interpolation_amount = 0.0f;
|
||||||
#ifdef _DEBUG
|
#ifdef false
|
||||||
printf("interpolation amount was %f, corrected to "
|
printf("interpolation amount was %f, corrected to "
|
||||||
"fix interpolation issues.\n",
|
"fix interpolation issues.\n",
|
||||||
cl.m_tickRemainder
|
cl.m_tickRemainder
|
||||||
|
|
|
@ -5064,10 +5064,6 @@ bool C_BaseAnimating::TestHitboxes( const Ray_t &ray, unsigned int fContentsMask
|
||||||
if ( !set || !set->numhitboxes )
|
if ( !set || !set->numhitboxes )
|
||||||
return false;
|
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.
|
// This *has* to be true for the existing code to function correctly.
|
||||||
Assert( ray.m_StartOffset == vec3_origin );
|
Assert( ray.m_StartOffset == vec3_origin );
|
||||||
|
|
||||||
|
|
|
@ -1490,9 +1490,10 @@ bool IntersectRayWithOBB( const Ray_t &ray, const matrix3x4_t &matOBBToWorld,
|
||||||
VectorSubtract( vecOBBMaxs, vecOBBMins, vecOBBHalfDiagonal );
|
VectorSubtract( vecOBBMaxs, vecOBBMins, vecOBBHalfDiagonal );
|
||||||
vecOBBHalfDiagonal *= 0.5f;
|
vecOBBHalfDiagonal *= 0.5f;
|
||||||
|
|
||||||
float flRadius = vecOBBHalfDiagonal.Length() + ray.m_Extents.Length();
|
// TODO_ENHANCED: make sphere hitboxes.
|
||||||
if ( !IsRayIntersectingSphere( ray.m_Start, ray.m_Delta, vecOBBCenter, flRadius, flTolerance ) )
|
// float flRadius = vecOBBHalfDiagonal.Length() + ray.m_Extents.Length();
|
||||||
return false;
|
// 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.
|
// 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
|
// 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;
|
temp.type = 3;
|
||||||
|
|
||||||
MatrixITransformPlane( matOBBToWorld, temp, pTrace->plane );
|
MatrixTransformPlane( matOBBToWorld, temp, pTrace->plane );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue