SA-MP Forums Archive
func GetDirect3D() for help +Rep - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: func GetDirect3D() for help +Rep (/showthread.php?tid=584524)



func GetDirect3D() for help +Rep - Logofero - 05.08.2015

Objective: We know the distance and coordinates of points A and B. How to get coordinates of point C for a given distance?

More detail in picture


AW: func GetDirect3D() for help +Rep - Nero_3D - 05.08.2015

pawn Код:
GetDirect3D(Float: dist, Float: X1, Float: Y1, Float: Z1, Float: X2, Float: Y2, Float: Z2, & Float: X3, & Float: Y3, & Float: Z3) {
    dist /= VectorSize((X2 -= X1), (Y2 -= Y1), (Z2 -= Z1));

    X3 = X1 + X2 * dist;
    Y3 = Y1 + Y2 * dist;
    Z3 = Z1 + Z2 * dist;
}



Re: AW: func GetDirect3D() for help +Rep - Logofero - 05.08.2015

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
pawn Код:
GetDirect3D(Float: dist, Float: X1, Float: Y1, Float: Z1, Float: X2, Float: Y2, Float: Z2, & Float: X3, & Float: Y3, & Float: Z3) {
    dist /= VectorSize((X2 -= X1), (Y2 -= Y1), (Z2 -= Z1));

    X3 = X1 + X2 * dist;
    Y3 = Y1 + Y2 * dist;
    Z3 = Z1 + Z2 * dist;
}
Thank you very much. Just right