Permalink
Browse files

Replace Following Missile TraceRay with Distance Check

This increase the performance.
  • Loading branch information...
Bara committed Oct 24, 2018
1 parent 77b8879 commit 4eed3986d73418d2c3cca769132358f1cefe7884
Showing with 12 additions and 8 deletions.
  1. +12 −8 addons/sourcemod/scripting/ttt/ttt_missiles.sp
@@ -524,25 +524,29 @@ public void MissileThink(const char[] output, int caller, int activator, float d
GetClientAbsOrigin(iClosestEnemy, fEnemyPos);
fEnemyPos[2] += 50.0;
Handle hTrace = TR_TraceRayFilterEx(fNadePos, fEnemyPos, MASK_PLAYERSOLID, RayType_Infinite, TR_DontHitSelf, caller);
int iTarget = -1;
// float fDistance = 0.0;
float fDistance = 0.0;
fDistance = GetVectorDistance(fNadePos, fEnemyPos);
PrintToChatAll("Target: %d, Distance: %f", iClosestEnemy, fDistance);
if(fDistance < 34.0)
{
CreateExplosion(caller);
}
/*Handle hTrace = TR_TraceRayFilterEx(fNadePos, fEnemyPos, MASK_PLAYERSOLID, RayType_Infinite, TR_DontHitSelf, caller);
int iTarget = -1;
if (TR_DidHit(hTrace))
{
iTarget = TR_GetEntityIndex(hTrace);
// fDistance = GetVectorDistance(fNadePos, fEnemyPos);
// PrintToChatAll("Target: %d, Distance: %f", iClosestEnemy, fDistance);
if (iTarget == iClosestEnemy)
{
CreateExplosion(caller);
}
}
delete hTrace;
delete hTrace; */
}
}
else if (g_iType[iOwner] == tControl)

0 comments on commit 4eed398

Please sign in to comment.