Inside3D!
     

Traceline problem

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
venomus



Joined: 24 May 2005
Posts: 44

PostPosted: Sat Jul 29, 2006 11:10 am    Post subject: Traceline problem Reply with quote

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
View user's profile Send private message
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Sat Jul 29, 2006 11:29 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
venomus



Joined: 24 May 2005
Posts: 44

PostPosted: Sat Jul 29, 2006 12:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
venomus



Joined: 24 May 2005
Posts: 44

PostPosted: Sat Jul 29, 2006 12:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
venomus



Joined: 24 May 2005
Posts: 44

PostPosted: Mon Aug 21, 2006 9:46 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group