View previous topic :: View next topic |
Author |
Message |
venomus
Joined: 24 May 2005 Posts: 44
|
Posted: Sat Jul 29, 2006 11:10 am Post subject: Traceline problem |
|
|
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: |
makevectors (self.v_angle);
v = v_forward;
st = self.origin + '0 0 16';
...
en = st + v * 15000;
traceline (st, en, FALSE, self);
|
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: |
entrance = trace_endpos;
in_a_bit = entrance + v;
traceline (in_a_bit, en, TRUE, self);
far_wall = trace_endpos - v;
|
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: |
if (trace_allsolid)
{
return;
}
traceline (far_wall, entrance, TRUE, self);
|
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.
 |
|
Back to top |
|
 |
FrikaC Site Admin

Joined: 08 Oct 2004 Posts: 947
|
Posted: Sat Jul 29, 2006 11:29 am Post subject: |
|
|
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? |
|
Back to top |
|
 |
venomus
Joined: 24 May 2005 Posts: 44
|
Posted: Sat Jul 29, 2006 12:29 pm Post subject: |
|
|
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. |
|
Back to top |
|
 |
venomus
Joined: 24 May 2005 Posts: 44
|
Posted: Sat Jul 29, 2006 12:41 pm Post subject: |
|
|
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. |
|
Back to top |
|
 |
venomus
Joined: 24 May 2005 Posts: 44
|
Posted: Mon Aug 21, 2006 9:46 pm Post subject: |
|
|
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. |
|
Back to top |
|
 |
|