Retrieving coordinates from vehicle side - 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: Retrieving coordinates from vehicle side (
/showthread.php?tid=311465)
Retrieving coordinates from vehicle side -
SWEMike - 16.01.2012
How do I retrieve coordinates for the side of a vehicle no matter what angle it has? I'm not very good with the advanced mathematical stuff yet.
Re: Retrieving coordinates from vehicle side -
sabretur - 16.01.2012
Use floatsin(), floatcos().
Re: Retrieving coordinates from vehicle side -
SWEMike - 16.01.2012
As I said, I'm not very good with advanced mathematics. I don't know the rest of the equation that I would need...
Re: Retrieving coordinates from vehicle side -
sabretur - 16.01.2012
Quote:
Originally Posted by SWEMike
As I said, I'm not very good with advanced mathematics. I don't know the rest of the equation that I would need...
|
Okay, you aren't very good at maths, so I will try to explain:
To right side:
pawn Код:
new Float:x,Float:y,Float:z;
new Float:distance = 10; // A distance to vehicle's side point
GetVehiclePos(vehicleid,x,y,z);
new Float:x1 = x + distance * floatsin(90 - angle,degrees);
new Float:y1 = y + distance * floatcos(90 - angle,degrees);
To left side:
pawn Код:
new Float:x,Float:y,Float:z;
new Float:distance = 10; // A distance to vehicle's side point
GetVehiclePos(vehicleid,x,y,z);
new Float:x1 = x + distance * floatsin(270 - angle,degrees);
new Float:y1 = y + distance * floatcos(270 - angle,degrees);
I hope you understand this.
Re: Retrieving coordinates from vehicle side -
SWEMike - 16.01.2012
Thank you! I'm not good at this kind of math yet. I'm in the electricity and energy program in school though and we have to learn trigonometry and stuff soon. I just wanted to defend my manhood. LOL Seriously, I will probably get the hang of it completely when I actually try to learn it.