12.03.2009, 20:46
Try this:
pawn Код:
/*Parameters
start[] : point A's coords
end[] : point B's coords
lenght : distance from point A to point C
coords : array where will be stored point C's coords
*/
GetCoordsOnLine3D(Float:start[], Float:end[], Float:length, Float:coords[])
{
coords[0] = start[0] - end[0];
coords[1] = start[1] - end[1];
coords[2] = start[2] - end[2];
new Float:sqrt = floatsqroot((coords[0] * coords[0]) + (coords[1] * coords[1]) + (coords[2] * coords[2]));
if (sqrt < 0.01)
sqrt = 0.01;
coords[0] = -length * (coords[0] / sqrt) + start[0];
coords[1] = -length * (coords[1] / sqrt) + start[1];
coords[2] = -length * (coords[2] / sqrt) + start[2];
}

