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

TR_TraceRayFilter Through Multiple Entities?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
scorpius2k1
Senior Member
Join Date: Feb 2016
Old 12-05-2017 , 11:31   TR_TraceRayFilter Through Multiple Entities?
Reply With Quote #1

Is it possible to do a TR_TraceRayFilter, but have it go from one point to infinity & be able to detect all entities in it's path?

Example: If you have 2 players, and one stands in front of the other, the TR_TraceRayFilter will return only the first player entity in the line. How can I get both players if they are in that line?


If this is not possible with a single TR_TraceRayFilter, would there be a way to do it with multiple? My idea would be if you hit one entity at an endpoint, then start another TR_TraceRayFilter at the other side of the entity as a startpoint, and if that TR_TraceRayFilter hit's another entity...and so on.

__________________
{__ PIRATES COVE __} ● HIGH-KILL Community | Stats ●
Half-Life 2: Deathmatch
66.151.244.149:27016 => CONNECT

Last edited by scorpius2k1; 12-05-2017 at 12:50. Reason: Add Visual Image
scorpius2k1 is offline
Timocop
AlliedModders Donor
Join Date: Mar 2013
Location: Germany
Old 12-05-2017 , 17:21   Re: TR_TraceRayFilter Through Multiple Entities?
Reply With Quote #2

Just pass an ArrayStack or ArrayList into the trace callback and fill it.
PHP Code:
void DoStuff()
{
    
//...
    
    
ArrayStack entStack = new ArrayStack();
    
    
TR_TraceRayFilter(fPosfAngMASK_SHOTRayType_Infinite__TraceGetEntitysentStack);
    
    while(!
entStack.Empty)
    {
        
int entity entStack.Pop();
        
        
//do something with entity
    
}
    
    
delete entStack;
}

public 
bool __TraceGetEntitys(int entityint contentsMaskArrayStack entStack)
{
    
//...
    
    
entStack.Push(entity);
    
    return 
false;

Timocop is offline
scorpius2k1
Senior Member
Join Date: Feb 2016
Old 12-06-2017 , 13:28   Re: TR_TraceRayFilter Through Multiple Entities?
Reply With Quote #3

Quote:
Originally Posted by Timocop View Post
Just pass an ArrayStack or ArrayList into the trace callback and fill it.
Thanks Timocop, I'll give that a shot, much appreciated!
__________________
{__ PIRATES COVE __} ● HIGH-KILL Community | Stats ●
Half-Life 2: Deathmatch
66.151.244.149:27016 => CONNECT
scorpius2k1 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 06:51.


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