I know there is a way to check if there is anything between two entities using tracelines,
but what if I wanted it to only check for a certain type of entity?
(like, a certain classname, or one that has certain flags)
I need to check if there is a door between 2 entities basically, it mustn't check for walls, only door, could there be ANY way to do this?
thanks
specific traceline?
-
- Posts: 68
- Joined: Mon Oct 04, 2010 9:08 pm
- Location: Lincoln, California
specific traceline?
A truly rewarding experience for an AI coder: watching your ai navigate the map... makes all the time invested in the code worth it
-
- Posts: 68
- Joined: Mon Oct 04, 2010 9:08 pm
- Location: Lincoln, California
I don't fully understand your question but I'll give a shot at my two different interpretations of the question.
If you just want to check if there is a door entity between you just fire a trace and do a trace_ent.classname == "func_door" to check if its a door entity.
If you want to have the trace go through something:
1.) Trace from first entity forward (or where ever)
2.) if(trace_fraction < 1.0) // you hit something
3.) if(trace_ent.classname == "func_door") // check if its a door entity but could be anything
4.) Since we hit a door and we want it to go through... start a second trace starting from trace_endpos and continuing forward. Set the ignore entity to trace_ent. I'm pretty sure if it starts in a solid it ignores it until it comes outside too.
If you just want to check if there is a door entity between you just fire a trace and do a trace_ent.classname == "func_door" to check if its a door entity.
If you want to have the trace go through something:
1.) Trace from first entity forward (or where ever)
2.) if(trace_fraction < 1.0) // you hit something
3.) if(trace_ent.classname == "func_door") // check if its a door entity but could be anything
4.) Since we hit a door and we want it to go through... start a second trace starting from trace_endpos and continuing forward. Set the ignore entity to trace_ent. I'm pretty sure if it starts in a solid it ignores it until it comes outside too.
A good example for that is on QuakeSrc.org i think.
http://www.quake-1.com/docs/quakesrc.org/49.html
http://www.quake-1.com/docs/quakesrc.org/49.html
-
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
-
- Posts: 68
- Joined: Mon Oct 04, 2010 9:08 pm
- Location: Lincoln, California
Yea to go through walls or the map bsp you'd have to use a series of traces (while loop'd or recursive) stop when you've either hit a door or you reached your destination.blubswillrule wrote:yes, one that goes through walls, BUT checks if it hits a door.
it would be nice to have, but not terribly important for the time being.