AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Getting brush entity height (https://forums.alliedmods.net/showthread.php?t=216786)

.Dare Devil. 05-25-2013 12:38

Getting brush entity height
 
Hello Allied Modders!
Im trying to get nonsolid brush entity height but...

Code:
PHP Code:

        pevidpev_origino1 )
        static 
Float:end[3], Float:end2[3], trFloat:dd
        xs_vec_sub
o1Float:{ 0.00.0, -9999.0 }, end )
        
engfuncEngFunc_TraceLineo1endIGNORE_MONSTERS0tr )
        
get_tr2trTR_vecEndPosend )
        
set_peventpev_movetypeMOVETYPE_TOSS )
        
set_peventpev_solidSOLID_BBOX )
        
set_peventpev_originFloat:{ 0.00.00.0 } )
        
        
xs_vec_subendFloat:{ 0.00.09999.0 }, end2 )
        
engfuncEngFunc_TraceLineendend2IGNORE_MONSTERS0tr )
        
get_tr2trTR_vecEndPosend2 )
        
dd end2[2] - o1[2]
        
pn_print1"dist:%f org: %f/%f/%f"ddend[2], end2[2], o1[2] )
        
entity_set_int(entEV_INT_solidSOLID_TRIGGER)
        
entity_set_int(entEV_INT_movetypeMOVETYPE_NOCLIP)
        
set_peventpev_originFloat:{ 0.00.00.0 } ) 

Last traceline go through the entity...
Mayby someone can correct my code and tell me what i did wrong.
And as always, thanks!

ConnorMcLeod 05-25-2013 13:01

Re: Getting brush entity height
 
Send SetOrigin or SetSize, set pev_origin has no effect.
Anyway, origin is not used with brush entities, so for your start and end trace position, you have to deal with absmin and absmax.

.Dare Devil. 05-29-2013 17:28

Re: Getting brush entity height
 
Quote:

Originally Posted by ConnorMcLeod (Post 1958276)
Send SetOrigin or SetSize, set pev_origin has no effect.
Anyway, origin is not used with brush entities, so for your start and end trace position, you have to deal with absmin and absmax.

uh, still having problems with that
PHP Code:

        static Float:end[3], Float:end2[3], trFloat:dd
        pev
entpev_absmaxo6 )
        
peventpev_absmin)
        
xs_vec_subo1Float:{ 0.00.0, -9999.0 }, end )
        
engfuncEngFunc_TraceLineo1endIGNORE_MONSTERS0tr )
        
get_tr2trTR_vecEndPosend )
        
set_peventpev_movetypeMOVETYPE_TOSS )
        
set_peventpev_solidSOLID_BBOX )
        
set_peventpev_absmino6 )
        
entity_set_origin(entFloat:{ 0.2,0.2,0.2}) 
        
// entity_set_size(ent, o6, v) // this say that min/max backwards:: it was bacwards, i fix it but still setting size not helping.
        // also, each time when this code run somehow the entity size (absmin&max) get bigger every time, caused by entity_set_size
        
xs_vec_subendFloat:{ 0.00.09999.0 }, end2 )
        
engfuncEngFunc_TraceLineendend2IGNORE_MONSTERS0tr )
        
get_tr2trTR_vecEndPosend2 )
        
dd end2[2] - o1[2]
        
pn_print1"dist:%f org: %f/%f(%f)/%f"ddend[2], end2[2], ps(idps_water_height), o1[2] )
        
// ps(id, ps_water_height) return a value here entity height should be.
        // because brush entity can have many heights i cant use it because i can get ohter heights, only the higher point.
        
entity_set_int(entEV_INT_solidSOLID_TRIGGER)
        
entity_set_int(entEV_INT_movetypeMOVETYPE_NOCLIP)
        
set_peventpev_absmino6 )
        
entity_set_origin(entFloat:{ 0.1,0.1,0.1})
        
// entity_set_size(ent, o6, v) 

Mayby i didint get that what you exacly meant.

.Dare Devil. 05-29-2013 17:54

Re: Getting brush entity height
 
oh right SOLID_BSP not SOLID_BBOX because of flag IGNORE_MONSTERS.
Stupid me... :oops:

Oh ConnorMcLeod, what i would do without you. Thank you so much!


All times are GMT -4. The time now is 16:26.

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