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

Solved [CS:GO] (best) method to check if a vector intersects with a trigger?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kinsi
Senior Member
Join Date: Apr 2013
Old 07-19-2017 , 18:34   [CS:GO] (best) method to check if a vector intersects with a trigger?
Reply With Quote #1

Hey there,

currently i need to check if a given vector intersects with a teleport trigger (and then modify it in accordance to it being "teleported"). The only way i can think of to implement this is to loop all teleport triggers, get their bounds and origin, check if the point intersects with it, and then do the teleporting.

The question: Is there a better way (In terms of performance)? Or am i simply out of luck. Thanks!

Last edited by Kinsi; 07-19-2017 at 22:02.
Kinsi is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 07-19-2017 , 18:39   Re: [CS:GO] (best) method to check if a vector intersects with a trigger?
Reply With Quote #2

You can either use a trace ray or the method you are currently using.
However a traceray you'd have to filter out anything that's not a trigger teleport. It shouldn't be too performance heavy if you store the min/max of the triggers once before, if you are doing it multiple times a second or something.

Last edited by Mitchell; 07-19-2017 at 18:40.
Mitchell is offline
Kinsi
Senior Member
Join Date: Apr 2013
Old 07-19-2017 , 19:14   Re: [CS:GO] (best) method to check if a vector intersects with a trigger?
Reply With Quote #3

Quote:
Originally Posted by Mitchell View Post
if you are doing it multiple times a second or something.
Yup thats the thing. Thought so caching the values and going from that would be the best i can do.

Tracerays can hit (teleport) triggers? Never knew that. That would be even better since a trace is fired anways in my code. Do i need to use some special mask or something for that to work?

Last edited by Kinsi; 07-19-2017 at 20:59.
Kinsi is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 07-21-2017 , 12:38   Re: [CS:GO] (best) method to check if a vector intersects with a trigger?
Reply With Quote #4

Quote:
The only way i can think of to implement this is to loop all teleport triggers, get their bounds and origin, check if the point intersects with it, and then do the teleporting.
Please don't.. just do it once per map, at round_start (as that's when entities are spawned; unless you have a plugin that creates them mid-round) and cache the values into an array.
__________________
retired
shavit is offline
Kinsi
Senior Member
Join Date: Apr 2013
Old 07-23-2017 , 14:04   Re: [CS:GO] (best) method to check if a vector intersects with a trigger?
Reply With Quote #5

Quote:
Originally Posted by shavit View Post
Please don't.. just do it once per map.
Yeah no worries, i've implemented it like this
Kinsi 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:19.


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