Box collision/distance functions
1 Attachment(s)
original code is from the HLSDK (UTIL_EntitiesInBox). you can use these functions to determine if two entities are touching each other. i'm not going to explain what you can use this for.
functions are as follows: find_ent_in_box ( StartEntity, Float:mins[3], Float:maxs[3] ) Code:
// PARAMETERSCode:
// PARAMETERSCode:
// PARAMETERSCode:
// PARAMETERSCode:
* PARAMETERS:feel free to make suggestions. you don't have to use the include, you can just copy out the functions. check_collision_ext requires check_collision to work. get_box_distance written by VEN. |
Gj, wanted to see that.
Is there a way to get maxEntities with fakemeta? Also not sure but isn't it should be "<= maxEntities"? Or it counts world (0) either? Suggestion: To not confuse the coders change StartEntity to StartSearchAfter StartSearchAfter == StartEntity - 1 Since fakemeta and engine find_ent_* functions uses that method. EDIT: Now i see why this method seems so simple to me. Because actually i wanted not that exactly. A while ago i tried to create get_box_distance(Float:mins1[3], Float:maxs1[3], Float:mins2[3], Float:maxs2[3]) function (minimal possible distance between two points of different boxes). In my opinion this function would be even more useful because it may indicate not only if two boxes are touching but even it's distance. Also i think that such function would be more complicated. At the current time i can find distance between box corners but this isn't always actual (minimal) box dsistance. |
1 Attachment(s)
For those who don't want to manually tab things ect. (My web browser opens it as 1 line :/)
|
Quote:
Quote:
Quote:
Quote:
[edit] i am renaming get_collision_by_class to get_collision_ext and allowing you to specify whether to search by classname, target, or targetname like find_ent_by_owner. i am also adding find_box_list which functions nearly like find_sphere_class (aka, like the original UTIL_EntitiesInBox). i just need to test these. |
Quote:
Quote:
Quote:
Quote:
I.E. if you would specify "1" it would start search from "2". I just tested find_ent_in_sphere and got the same thing. I know that weird but not me created that functions. And as i said before the only reason of my suggestion was to not confuse the coders. Anyway it's just a "non-obligate suggestion". |
Finally i done get_box_distance function.
Though it's untested yet but i think it should work correctly. Feel free to test it or leave suggestions / comments. Code:
Kraugh: Probably it's better to add word "distance" to the topic title. I think better keep box functions in the one topic. Also if you wish you can: - merge our functions - create more distance functions like get_box_entity_distance, etc |
Quote:
Quote:
Quote:
|
Quote:
You're joking yourself right ? |
no.
[edit] expanding on that: the only thing fakemeta does better than engine is the forwards. no matter what, engine will hook into server_frame, client_PreThink, client_PostThink, and any others there might be, whether or not you intend to use them. other than that, engine is much better. http://forums.alliedmods.net/showthr...t=11567&page=2 the only reason to use fakemeta is for pdata and calls/hooks you couldn't otherwise access. |
Quote:
|
| All times are GMT -4. The time now is 20:19. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.