Raised This Month: $ Target: $400
 0% 

[Very Hard] Is origin inside of entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 04-29-2013 , 14:27   [Very Hard] Is origin inside of entity
Reply With Quote #1

I have a brush entity here ( yellow { thats one entity} )


I want to create point( with random origin ) and check that is point origin inside of this entity.
( I dont want to use touch because i need to do this without creating new entity )
Thanks!

Last edited by .Dare Devil.; 04-29-2013 at 14:29.
.Dare Devil. is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-29-2013 , 14:35   Re: [Very Hard] Is origin inside of entity
Reply With Quote #2

check this stock:

Code:
stock intersects(ent1,ent2) {     static Float:minsa[3], Float:maxsa[3]     static Float:minsb[3], Float:maxsb[3]         pev(ent1,pev_absmin, minsa)     pev(ent1,pev_absmax, maxsa)         pev(ent2,pev_absmin, minsb)     pev(ent2,pev_absmax, maxsb)     if(minsb[0] > maxsa[0] ||         minsb[1] > maxsa[1] ||         minsb[2] > maxsa[2] ||         maxsb[0] < minsa[0] ||         maxsb[1] < minsa[1] ||         maxsb[2] < minsa[2])         return 0     return 1 }

You can easily make it work for a point as well.

Last edited by Backstabnoob; 04-29-2013 at 14:40.
Backstabnoob is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 04-29-2013 , 14:57   Re: [Very Hard] Is origin inside of entity
Reply With Quote #3

Quote:
Originally Posted by Backstabnoob View Post
check this stock:

Code:
stock intersects(ent1,ent2) {     static Float:minsa[3], Float:maxsa[3]     static Float:minsb[3], Float:maxsb[3]         pev(ent1,pev_absmin, minsa)     pev(ent1,pev_absmax, maxsa)         pev(ent2,pev_absmin, minsb)     pev(ent2,pev_absmax, maxsb)     if(minsb[0] > maxsa[0] ||         minsb[1] > maxsa[1] ||         minsb[2] > maxsa[2] ||         maxsb[0] < minsa[0] ||         maxsb[1] < minsa[1] ||         maxsb[2] < minsa[2])         return 0     return 1 }

You can easily make it work for a point as well.
this will not work for my entity ( entity from picture )
you see it will check a box but what about ohter mdl poly what are inside of that abs box?
thats way i tagged it to very hard, ive tried many things for now and no idea how to do it.
.Dare Devil. is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-29-2013 , 15:42   Re: [Very Hard] Is origin inside of entity
Reply With Quote #4

That's most likely impossible, I believe HLEngine has no tools to set the entity's solid box by the model's shape.

You could probably give the entity some hitboxes and check if the point is in any of them, but I guess it won't be too amazing for what you're trying to achieve (as I'm sure you're not just throwing lego boxes around the map).
Backstabnoob is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 04-29-2013 , 16:17   Re: [Very Hard] Is origin inside of entity
Reply With Quote #5

If the entity is solid, you can use trace line. Just like unstuck methods (I guess)
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
pokemonmaster is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 04-29-2013 , 16:41   Re: [Very Hard] Is origin inside of entity
Reply With Quote #6

Quote:
Originally Posted by pokemonmaster View Post
If the entity is solid, you can use trace line. Just like unstuck methods (I guess)
Its kind a hard
Also i think entity is still needed with trace line...

now im having idea what sound crazy i know

PHP Code:
#pragma dynamic 8192
new chuckdata[8192][3
if the plugin_precache is called then i create one entity what will do that
1. set entity origin[0] -4096 origin[1] -4096 origin[2] -4096
2. wait, when touch is called check entity classnames and stuff and if it is that entity then
3. chuckdata[origin[0]][0] = 1; chuckdata[origin[1]][0] = 1; chuckdata[origin[2]][0] = 1
4. set entity origin[0] -4095 origin[1] -4096 origin[2] -4096
...

so then just check is point touching like that
if( chuckdata[pointoriginZ][0] && chuckdata[pointoriginZ][1] && chuckdata[pointoriginZ][2] )

but the problem is that if i check all units in map with 100fps / 2 ( one frame will go to touch )
then time to take to complete this process is 491,52 sec ( 8 minutes )
so basically players need wait 8 minutes before they can play? : )

( why 100 fps?, because my local game ( where i test ) fps is 100, server will be more than 100fps i think.. )

is there native to check touch? ( then i can do this in loop )

edit:

@pokemonmaster
I find this here engfunc(EngFunc_TraceHull, origin, origin, 0, hull, id, tr)
it does not need angles and such stuff like normal trace need, i test it mayby youre right and it can be done with that.
also is it good to call this tracehull 60-100 time per sec?

EDIT2:
I did tried this but no luck
o1 is point entity origin
engfunc(EngFunc_TraceHull, o1, o1, 0, HULL_POINT, 0, t)
pn_print( 1, "%d :: %d", get_tr2(t, TR_StartSolid), get_tr2(t, TR_AllSolid) )
I just dont know how to use this : /
Little help guys? ;(

EDIT3: My entity is SOLID_TRIGGER

Last edited by .Dare Devil.; 04-29-2013 at 18:19.
.Dare Devil. is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-30-2013 , 01:01   Re: [Very Hard] Is origin inside of entity
Reply With Quote #7

TraceHull seems a good option though, use hull_point and same origin as start and end, and check if pHit is your entity index. You may have to set your entity SOLID_smth_more_than_trigger during the trace and to set it back to trigger after.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 10:47.


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