Raised This Month: $ Target: $400
 0% 

find_sphere_class, how speccialy does it work?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
grs4
Senior Member
Join Date: Dec 2010
Location: Poland
Old 01-30-2017 , 06:16   find_sphere_class, how speccialy does it work?
Reply With Quote #1

Hi,
I did not found on internet information about, how entities in
Code:
find_sphere_class(aroundent, const _lookforclassname[], Float:radius, entlist[], maxents, const Float:origin[3])
entlist[] are returned.

I mean, if I will set radius to 1000.0, Do entities in variable entlist will be ordered by nearest?

eg. we have 5 entities in 1000.0 range from entity 50. So, entlist[0] will return nearest ent?
grs4 is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-30-2017 , 07:55   Re: find_sphere_class, how speccialy does it work?
Reply With Quote #2

PHP Code:
//from jghg2
/* As above, but returns number of ents stored in entlist. Use to find a specific type of entity classname (specify in _lookforclassname) around a
 * certain entity specified in aroundent. All matching ents are stored in entlist. Specify max amount of entities to find in maxents.
 * If aroundent is 0 its origin is not used, but origin in 6th parameter. Ie, do not specify 6th parameter (origin) if you specified an entity
 * in aroundent.
 */
native find_sphere_class(aroundent, const _lookforclassname[], Float:radiusentlist[], maxents, const Float:origin[3] = {0.00.00.0}); 
__________________
edon1337 is offline
grs4
Senior Member
Join Date: Dec 2010
Location: Poland
Old 01-30-2017 , 08:01   Re: find_sphere_class, how speccialy does it work?
Reply With Quote #3

You did not helped me.
Quote:
returns number of ents stored in entlist......All matching ents are stored in entlist.
It is not the anwser.
I know that it contains all elements in this radius, but I want to know if variable entlist is ordered ascending/descending by distance from aroundend
grs4 is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-30-2017 , 08:44   Re: find_sphere_class, how speccialy does it work?
Reply With Quote #4

Oh, I have no clue, thought that would help so I posted it.

Check these :

https://forums.alliedmods.net/showpo...64&postcount=4
https://forums.alliedmods.net/showpo...89&postcount=4
https://forums.alliedmods.net/showthread.php?t=47400
__________________

Last edited by edon1337; 01-30-2017 at 09:19.
edon1337 is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 01-30-2017 , 12:04   Re: find_sphere_class, how speccialy does it work?
Reply With Quote #5

They are in order of entity index.
Generally that is how entity finding functions works.
They loop through indexes, comparing distance and if it's within range, return it.
Spoiler


Usually sorting is not important and therefor a waste of resources. However, you can always sort them using SortCustom1D

Spoiler
__________________

Last edited by Black Rose; 01-30-2017 at 12:09.
Black Rose is offline
grs4
Senior Member
Join Date: Dec 2010
Location: Poland
Old 01-30-2017 , 18:16   Re: find_sphere_class, how speccialy does it work?
Reply With Quote #6

Thanks. That's what I wanted to know
grs4 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 20:55.


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