Ayuda, distancia entre...
#4

pawn Код:
stock Float:DistanceBetweenObjectAndPlayer(playerid)
{
    new Float:pos1[3], Float:pos2[3], Float:d, Float:distance = 9999.0;
    for(new slots = 1, idx = MAX_SLOTS; slots != idx; slots++)
    {
        GetObjectPos(VariableObjetos[slots], pos1[0], pos1[1], pos1[2]);
        GetPlayerPos(playerid, pos2[0], pos2[1], pos2[2]);
        d = floatsqroot(floatpower(floatabs(floatsub(pos1[0], pos2[0])), 2) + floatpower(floatabs(floatsub(pos1[1], pos2[1])),2) + floatpower(floatabs(floatsub(pos1[2], pos2[2])), 2));
        if(d < distance) distance = d;
    }
    return distance;
}
Reply


Messages In This Thread
Ayuda, distancia entre... - by OTACON - 21.12.2013, 08:39
Re: Ayuda, distancia entre... - by Miguel - 21.12.2013, 16:56
Respuesta: Ayuda, distancia entre... - by JustBored - 21.12.2013, 17:15
Respuesta: Ayuda, distancia entre... - by bm0z - 21.12.2013, 17:21
Respuesta: Ayuda, distancia entre... - by OTACON - 21.12.2013, 21:52

Forum Jump:


Users browsing this thread: 3 Guest(s)