PDA

View Full Version : [SOLVED] Get Entity origin|vector|velocity..


AngeIII
06-24-2010, 18:17
how I know origin=vector=velocity :P

but when I try to get for example "button" origins[3]

<fakemeta>

new iEntity;
while( ( iEntity = fm_find_ent_by_class( iEntity, "func_button" ) ) > 0 )
{
new Float:origin[3];
pev(iEntity, pev_velocity, origin)
server_print("%f ",origin[0]);
server_print("%f ",origin[1]);
server_print("%f ",origin[2]);
}
stock fm_find_ent_by_class(index, const classname[])
return engfunc(EngFunc_FindEntityByString, index, "classname", classname)
and I will test this:

new iEntity;
while( ( iEntity = fm_find_ent_by_class( iEntity, "func_button" ) ) > 0 )
{
new Float:origin[3];
pev(iEntity, pev_origin, origin)
server_print("%f ",origin[0]);
server_print("%f ",origin[1]);
server_print("%f ",origin[2]);
}
stock fm_find_ent_by_class(index, const classname[])
return engfunc(EngFunc_FindEntityByString, index, "classname", classname)
always return

server print:

0.000000
0.000000
0.000000
so, I think this function pev_velocity,pev_origin work only to "players"?

how to get Entity [button,doors..] origins?

xPaw
06-24-2010, 18:20
I guess you are trying to get pev_origin of brush (button, doors?) wich will always equal to { 0, 0, 0 }, you have to use get_brush_entity_origin( )

AngeIII
06-24-2010, 18:25
oh.. maybe :)

stock fm_get_brush_entity_origin(index, Float:origin[3]) {
new Float:mins[3], Float:maxs[3];

pev(index, pev_origin, origin);
pev(index, pev_mins, mins);
pev(index, pev_maxs, maxs);

origin[0] += (mins[0] + maxs[0]) * 0.5;
origin[1] += (mins[1] + maxs[1]) * 0.5;
origin[2] += (mins[2] + maxs[2]) * 0.5;

return 1;
}

Yeeah It's Work Thank You xPaw :)


new iEntity;
while( ( iEntity = fm_find_ent_by_class( iEntity, "func_button" ) ) > 0 )
{
new Float:origin[3];
fm_get_brush_entity_origin(iEntity,origin)
server_print("%f ",origin[0]);
server_print("%f ",origin[1]);
server_print("%f ",origin[2]);
}

fysiks
06-24-2010, 23:25
oh.. maybe :)

stock fm_get_brush_entity_origin(index, Float:origin[3]) {
new Float:mins[3], Float:maxs[3];

pev(index, pev_origin, origin);
pev(index, pev_mins, mins);
pev(index, pev_maxs, maxs);

origin[0] += (mins[0] + maxs[0]) * 0.5;
origin[1] += (mins[1] + maxs[1]) * 0.5;
origin[2] += (mins[2] + maxs[2]) * 0.5;

return 1;
}


No. Use what xPaw said.

xPaw
06-25-2010, 03:15
No. Use what xPaw said.
It's fine since not fm_ is stock as well

AngeIII
06-25-2010, 18:10
what is better?
<fakemeta>

stock fm_get_brush_entity_origin(index, Float:origin[3]) {
new Float:mins[3], Float:maxs[3];

pev(index, pev_origin, origin);
pev(index, pev_mins, mins);
pev(index, pev_maxs, maxs);

origin[0] += (mins[0] + maxs[0]) * 0.5;
origin[1] += (mins[1] + maxs[1]) * 0.5;
origin[2] += (mins[2] + maxs[2]) * 0.5;

return 1;
}
or <engine>

stock get_brush_entity_origin(ent, Float:orig[3])
{
new Float:Min[3], Float:Max[3];

entity_get_vector(ent, EV_VEC_origin, orig);
entity_get_vector(ent, EV_VEC_mins, Min);
entity_get_vector(ent, EV_VEC_maxs, Max);

orig[0] += (Min[0] + Max[0]) * 0.5;
orig[1] += (Min[1] + Max[1]) * 0.5;
orig[2] += (Min[2] + Max[2]) * 0.5;

return 1;
}
i'm using fakemeta work good:wink:

fysiks
06-25-2010, 19:23
It's fine since not fm_ is stock as well

Oh. lol.