Quote:
Originally Posted by DarthMan
I used find entity in sphere, but I don't know how to get them in a line from fOrigin to fRet. So this acts like a TraceLine, and I only want to look at entities from that line. If I user vector_distance the normal way it won't work as I want to. I can try getting all entities origin, and check if there is a close distance between the entity origin and fRet, but, wouldn't that check it in a sphere? Like it can return a wrong entity.
|
PHP Code:
new Float:MaxDistance = 500.0, Float:fDistance;
new ent, Float:origin_1[3], Float:origin_2[3], iTarget;
while( (ent = engfunc(EngFunc_FindEntityInSphere, ent, origin_1, MaxDistance) > 0)
{
pev(ent, pev_origin, origin_2)
if((fDistance = get_distance_f(origin_1, origin_2)) < MaxDistance)
{
iTarget = ent;
MaxDistance = fDistance;
}
}
Origin_1 is where your point 1 is located
__________________