AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Very Hard] Is origin inside of entity (https://forums.alliedmods.net/showthread.php?t=214634)

.Dare Devil. 04-29-2013 14:27

[Very Hard] Is origin inside of entity
 
I have a brush entity here ( yellow { thats one entity} )
http://www.upload.ee/image/3274187/__entity.png

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!

Backstabnoob 04-29-2013 14:35

Re: [Very Hard] Is origin inside of entity
 
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.

.Dare Devil. 04-29-2013 14:57

Re: [Very Hard] Is origin inside of entity
 
Quote:

Originally Posted by Backstabnoob (Post 1942310)
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.

Backstabnoob 04-29-2013 15:42

Re: [Very Hard] Is origin inside of entity
 
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).

pokemonmaster 04-29-2013 16:17

Re: [Very Hard] Is origin inside of entity
 
If the entity is solid, you can use trace line. Just like unstuck methods (I guess)

.Dare Devil. 04-29-2013 16:41

Re: [Very Hard] Is origin inside of entity
 
Quote:

Originally Posted by pokemonmaster (Post 1942467)
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

ConnorMcLeod 04-30-2013 01:01

Re: [Very Hard] Is origin inside of entity
 
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.


All times are GMT -4. The time now is 10:47.

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