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

TR_TraceHullFilter - Only Hit Players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lange
Member
Join Date: Apr 2009
Old 05-02-2010 , 04:08   TR_TraceHullFilter - Only Hit Players
Reply With Quote #1

Trying to set up a TraceHull at a specific point, and have it only hit other players. Been at it for a while and I've made zero progress, can anyone offer some advice? It seems to return a hit no matter what I set any of the arguments to.

On a related note, does anyone know the hull size for players in TF2?
Lange is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 05-02-2010 , 09:53   Re: TR_TraceHullFilter - Only Hit Players
Reply With Quote #2

the function you choose for the filter will fire everytime the ray hits an entity and will give you its index so you can check whether that index is a player. then you can choose whether the ray should hit the entity or ignore it.

PHP Code:
public bool:MyFilter(entitycontentsMaskany:data)
{
   if ((
entity 0) && (entity <= MaxClients))
   {
      return 
true;
   }
   else
   {
      return 
false;
   }

returning true lets the ray hit the entity, false makes it ignore it.
if you don't pass any data to the filter then you can use this prototype instead.

PHP Code:
public bool:MyFilter(entitycontentsMask
the hull size for player will vary depending if they are standing or crouching. you can get the hull size with the entity props "m_vecMins" and "m_vecMaxs".
blodia is offline
Lange
Member
Join Date: Apr 2009
Old 05-02-2010 , 14:11   Re: TR_TraceHullFilter - Only Hit Players
Reply With Quote #3

You're a lifesaver mate. Don't know why I was convinced I was capable of figuring this out at 4 AM, it all makes so much more sense after 8 hours of sleep.
Lange 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 08:38.


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