View Single Post
Podbots cannot shoot breakables
Old
  (#1)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Podbots cannot shoot breakables - 07-07-2004

well here's one problem I can't solve since I barely know any math...
and here's the reason....

This image shows the 2 tracelines sent to try and search for the breakable..
as you can see.. they are going the wrong direction..
here's the code..
Code:
bool BotFindBreakable (bot_t *pBot)
{
   // Checks if Bot is blocked by a Shootable Breakable in his moving direction

   TraceResult tr;
   edict_t *pEdict = pBot->pEdict;

   Vector v_src = pEdict->v.origin;
   Vector vecDirection = (pBot->pShootBreakable->v.origin - v_src).Normalize ();
   Vector v_dest = v_src + vecDirection * 50;

   TRACE_LINE (v_src, v_dest, dont_ignore_monsters, pEdict, &tr);
   if ((tr.flFraction != 1.0)
       && (FStrEq ("func_breakable", STRING (tr.pHit->v.classname))
       || FStrEq ("func_pushable", STRING (tr.pHit->v.classname)))
       && IsShootableBreakable (tr.pHit))
   {
      pBot->vecBreakable = tr.vecEndPos;
      return (TRUE);
   }

   v_src = GetGunPosition (pEdict);
   vecDirection = (pBot->pShootBreakable->v.origin - v_src).Normalize ();
   v_dest = v_src + vecDirection * 50;

   TRACE_LINE (v_src, v_dest, dont_ignore_monsters, pEdict, &tr);
   if ((tr.flFraction != 1.0)
       && (FStrEq ("func_breakable", STRING (tr.pHit->v.classname))
       || FStrEq ("func_pushable", STRING (tr.pHit->v.classname)))
       && IsShootableBreakable (tr.pHit))
   {
      pBot->vecBreakable = tr.vecEndPos;
      return (TRUE);
   }

   pBot->pShootBreakable = NULL;
   pBot->vecBreakable = g_vecZero;
   return (FALSE);
}
All we need is a math wiz that knows how to figure out what direction a point is from another point...
anyone know how?
[edit]
Me are reading pages that teach this stuff
[/edit]

Last edited by sPlOrYgOn; 07-07-2004 at 06:32..
  
Reply With Quote