Raised This Month: $51 Target: $400
 12% 

Make a Trace Ray ignore everything except an entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 08-04-2010 , 14:49   Make a Trace Ray ignore everything except an entity
Reply With Quote #1

I thought that setting up a filter with a trace ray, and only returning true if it hits an entity would make it ignore walls, but I guess this is not true. The ray ends at anything solid, even though I added this:

Code:
new Handle:Trace = TR_TraceRayFilterEx(TraceOrg, TraceAng, MASK_SHOT, RayType_Infinite, TraceFilter, Ent);
Code:
public bool:TraceFilter(entity, contentsMask, any:Ent)
{
if(entity == Ent)
{
return true;
}
return false;
}
What could be wrong?
__________________
almcaeobtac is offline
DarkEnergy
SourceMod Donor
Join Date: Apr 2008
Location: Georgia Tech, MSECE
Old 08-04-2010 , 15:14   Re: Make a Trace Ray ignore everything except an entity
Reply With Quote #2

maybe u need a different MASK_? or that the engine always stops at a wall?
DarkEnergy is offline
SimonTheOne
Member
Join Date: Apr 2010
Old 08-04-2010 , 15:35   Re: Make a Trace Ray ignore everything except an entity
Reply With Quote #3

try this:

PHP Code:
new Handle:Trace TR_TraceRayFilterEx(TraceOrgTraceAngMASK_SOLIDRayType_InfiniteTraceFilter); 
PHP Code:
public bool:TraceFilter(entitycontentsMaskany:Ent)
{
if (
IsValidEntity(entity);
{
return 
true;
}

else
{
return 
false
}


Last edited by SimonTheOne; 08-04-2010 at 15:36. Reason: little mistake sry :P
SimonTheOne is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 08-04-2010 , 15:36   Re: Make a Trace Ray ignore everything except an entity
Reply With Quote #4

I know that the source engine automaticly stops drawing behind walls, but if he managed to check behind that wall, it should've been loaded.
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 08-04-2010 , 17:48   Re: Make a Trace Ray ignore everything except an entity
Reply With Quote #5

*SOLVED*
__________________
almcaeobtac is offline
DarkEnergy
SourceMod Donor
Join Date: Apr 2008
Location: Georgia Tech, MSECE
Old 08-05-2010 , 14:38   Re: Make a Trace Ray ignore everything except an entity
Reply With Quote #6

how did u solve this?
DarkEnergy is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 08-05-2010 , 14:48   Re: Make a Trace Ray ignore everything except an entity
Reply With Quote #7

I would guess Simon's solution? Only one here.
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 08-05-2010 , 15:05   Re: Make a Trace Ray ignore everything except an entity
Reply With Quote #8

Posting solutions could benefit others wanting to do the same thing.
__________________
Greyscale is offline
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 08-05-2010 , 17:28   Re: Make a Trace Ray ignore everything except an entity
Reply With Quote #9

Woops sorry. Before, I was making the ray start 1024 units from the entity's origin, then sending it back. It was hitting walls and stopping. So instead of starting it 1024 units away, I created a ray first, and made it run from the entity's origin until it hit a wall, then start there instead. That way it couldn't possibly hit a wall before hitting the entity.

Also, I couldn't find a way to make it ignore walls, that's why I just bypassed it.
__________________
almcaeobtac is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:06.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode