SA-MP Forums Archive
[Pedido] Funcao Angle - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Pedido] Funcao Angle (/showthread.php?tid=615327)



Funcao Angle - minimessi10 - 20.08.2016

Podem me passar alguma funзгo que me de a possibilidade de setar a rotaзгo do veнculo na direзгo de um ponto x, y e z se possivel.

Exemplo: SetVehicleAngle(vid, 0.0, 0.0, 0.0);


Re: Funcao Angle - RodrigoMSR - 20.08.2016

Код:
stock Float:GetRotationBetweenPoints(Float:x1, Float:y1, Float:x2, Float:y2) return Float:(180-atan2(x1-x2,y1-y2));
Exemplo:
Код:
new Float:x, Float:y, Float:z;
GetVehiclePos(veh, x, y, z);
new Float:angle = GetRotationBetweenPoints(x, y, 666, 666);
SetVehicleZAngle(veh, angle);