Forum

Traceline problem

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Traceline problem

Postby venomus » Sat Jul 29, 2006 11:10 am

Hi everyone, its venomus. After seeing this Qexpo I was inspired to start modding for Quake again. Trying to remake the gauss gun from half-life as a weapons mod.
But I've run into some weird problems with traceline. Let me explain how the weapon works with these diagrams.

First traceline, hit a wall

Code: Select all
   makevectors (self.v_angle);
   v = v_forward;
   st = self.origin + '0 0 16';
...
   en = st + v * 15000;
   traceline (st, en, FALSE, self);


Image

If the conditions are right for wall penetration (right angle, secondary fire), do another trace from just inside the wall to the same end point

Code: Select all
   entrance = trace_endpos;
   in_a_bit = entrance + v;
   traceline (in_a_bit, en, TRUE, self);
   far_wall = trace_endpos - v;


Image

As long as trace_allsolid != 1 (i.e. we didn't fire into the outer hull of the map), trace back to find the point where we exited the first wall.

Code: Select all
   if (trace_allsolid)
   {
      return;
   }
   traceline (far_wall, entrance, TRUE, self);


Image

At the current trace_endpos we would now do an explosion, and that's how it's supposed to work. Sometimes it does work properly, but other times the following happens: the trace_allsolid test returns true even if there is a void of empty space along the third traceline. If I remove the trace_allsolid test, then the third traceline still fails to find the correct exit point.

This seems to happen in certain places but not others, for example if I am standing facing the Normal Skill teleporter in the start map and fire at Hard Skill wall, it works correctly. But if I fire at the Easy Skill wall it does not.

Image
Image
venomus
 
Posts: 41
Joined: Tue May 24, 2005 4:54 pm

Postby FrikaC » Sat Jul 29, 2006 11:29 am

Odd. I'd recommend using if (!(trace_inopen || trace_inwater)) instead of allsolid if that was the only problem....

Are you sure your trajectory is correct?
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby venomus » Sat Jul 29, 2006 12:29 pm

Doesn't seem to make a difference. If I remove the trace_allsolid test entirely, then the third traceline fails to hit on the opposite side of the wall on its way back, i.e. trace_endpos = entrance . It's as if it can't detect any empty space on the other side of the wall.
venomus
 
Posts: 41
Joined: Tue May 24, 2005 4:54 pm

Postby venomus » Sat Jul 29, 2006 12:41 pm

I tried adjusting the initial distance from 15000 to 1500 and then 150, which seems to help in some cases. Looks like I might have to debug the engine to see whats happening.
venomus
 
Posts: 41
Joined: Tue May 24, 2005 4:54 pm

Postby venomus » Mon Aug 21, 2006 9:46 pm

Well it's been a long time coming (mainly because I put off trying to fix it and got on with other things, Quake related or not). But I'm now pretty sure that a traceline starting in solid will not work properly.

While I will do my best to try and understand the collision detection code (not a given), if anyone can prove me wrong and point to an example of working tracelines starting in solid I'd be interested in looking at them. Examples might be weapons that fire through walls like in counterstrike, I looked for weapon mods or similar with something like that but did not find any.
venomus
 
Posts: 41
Joined: Tue May 24, 2005 4:54 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest