Forum

trace->fraction

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

trace->fraction

Postby r00k » Mon Jul 19, 2010 9:48 am

I was messing around with this in SV_RecursiveHullCheck
Code: Select all
   if (trace->fraction <= p1f)
   {
      Con_DPrintf("SV_RecursiveHullCheck: trace->fraction <= p1f\n");
      return false;      
   }


and noticed that after a memset (&trace, 0, sizeof(trace));
like in void TraceLine (vec3_t start, vec3_t end, vec3_t impact)

the above condition fubar'd the chase_active code.
Which led me to initialize trace.fraction = 1; whenever i started a trace. Now is this good practice or just paranoia?

(BTW, it's 4:50am and i've been up all night so my brain is melting)
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby Spike » Mon Jul 19, 2010 10:11 am

recursivehullcheck does not initialise the trace, you need to do that in the caller. Initialising fraction to 1 will cause it to go the full distance when it starts solid. It won't affect anything if it actually hits a wall.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest