AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   right above water (https://forums.alliedmods.net/showthread.php?t=127801)

Voi 05-25-2010 01:12

right above water
 
I have an "info_target" point entity in the func_water brush entity and I want to discover a point in the Z axis that is right above the boundaries of func_water entity the "info_target" entity is in. So the X and Y coords for this point would be the same as "info_target" and Z coords would've been right above the water model - not the water origin point, but the whole water model. :mrgreen: Hope you did understand.


[IMG]http://img192.**************/img192/862/lolz1y.png[/IMG]

My first thought would be getting the index and then origin of the func_water the info_target is in, then getting the entity size and adding "entity z size /2" to the z coord of func_water.

Exolent[jNr] 05-25-2010 17:39

Re: right above water
 
Why don't you try what you thought of?

Code:
// iEntity = func_water entity new Float:vecAbsMin[ 3 ], Float:vecAbsMax[ 3 ]; entity_get_vector( iEntity, EV_VEC_absmin, vecAbsMin ); entity_get_vector( iEntity, EV_VEC_absmax, vecAbsMax ); // origin = ( absmin + absmax ) / 2 new Float:vecOrigin[ 3 ]; xs_vec_add( vecAbsMin, vecAbsMax, vecOrigin ); xs_vec_div_scalar( vecOrigin, 2.0, vecOrigin ); // keep the maximum height vecOrigin[ 2 ] = vecAbsMax[ 2 ];

Voi 05-25-2010 18:48

Re: right above water
 
Yeah but i don't know how to get the index of func_water the info_target would be in.

Emp` 05-25-2010 19:24

Re: right above water
 
use find_ent_by_class(iIndex, const szClass[]) with "func_water" and compare the info_target's origin to the mins/maxs of the func_water to see if it is corresponding func_water entity.

Voi 05-26-2010 00:10

Re: right above water
 
Quote:

Originally Posted by Emp` (Post 1191191)
use find_ent_by_class(iIndex, const szClass[]) with "func_water" and compare the info_target's origin to the mins/maxs of the func_water to see if it is corresponding func_water entity.

This isn't working when you have func_water based on multiple brushes(for example de_aztec). I would rather need to check touch at one frame only. I would register touch, but i don't need to check touch every frame, so it would be a waste of resources. I would need something like:

Code:

get_entity_touching(ent, classname)


All times are GMT -4. The time now is 05:17.

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