12.02.2013, 09:27
Coordinate system explanation
Introduction
I've seen a lot of newbies being frustrated by how a little coordinate can cause their players or objects to go into bad positions. Even a lot of pro scripters do not understand the simple functioning of the X-Y-Z coordinates system of SA-MP. So I decided to make a little tutorial to explain how this came into being and how it works.
X Y Z - What do they mean?
X Y Z is a simple coordinate system, both in real life and in virtual worlds. SA-MP makes use of this system in spawns, object locations, vehicle locations, text label locations, textdraw locations and etc.
Although it is nearly impossible to detect X and Y on land (unless you refer to GTA SA's radar and carefully read the radar to find out X and Y), it is still possible to manually edit Z easily, without having to re-do all the /save ing
X – east-west direction
Y – north-south direction
Z – height information
X Y Z is mainly used in real life for GPS navigation, while more advanced examples can be the Cartesian coordinate system, or the Three-dimensional space system.
Implementation in SA-MP
The following example is a movement from the same starting point.
NOTE - The starting point of West and East is the point from North, while the starting point of North is from SPAWNED location.
Now, let's simplify the code so that we can only look at the X Y Z locations
The starting point is
X - 2495.3356
Y - -1690.2634.147656
Z - 14.7656
To be precise, this means
X – east-west direction - 2495.3356
Y – north-south direction - -1690.2634.147656
Z – height information - 14.7656
In even simpler words, it means 2495.3356 east, 1690.2634.147656 south and 14.7656 above sea level.
X means east-west direction
If the location is in -, then it's in west, but if it's in +, then it's in the east. The numbers indicate the DISTANCE from the center of GTA SA i.e the blueberry farm
Y means north-south direction
If it's in -, then it's in south, but if it's +, then it's in the north. The numbers indicate the distance from the center.
Z means height above sealevel.
If it's in -, then it's BELOW sea level, but if it's +, then it's above sealevel. The numbers indicate height above/below sea level.
NOTE - AVOID EDITING COORDINATES MANUALLY FROM INTERIORS
NOTE - SEA LEVEL IS ALWAYS 0 Z
NOTE 2 ^- IF YOU GET COORDINATES INSIDE THE SEA, THE Z CAN DIFFER FROM 0 DUE TO THE DIFFERENT CONDITIONS OF THE WEATHER IN GTA
I hope this helps
P.S - Images from Wiki articles
I've seen a lot of newbies being frustrated by how a little coordinate can cause their players or objects to go into bad positions. Even a lot of pro scripters do not understand the simple functioning of the X-Y-Z coordinates system of SA-MP. So I decided to make a little tutorial to explain how this came into being and how it works.
X Y Z - What do they mean?
X Y Z is a simple coordinate system, both in real life and in virtual worlds. SA-MP makes use of this system in spawns, object locations, vehicle locations, text label locations, textdraw locations and etc.
Although it is nearly impossible to detect X and Y on land (unless you refer to GTA SA's radar and carefully read the radar to find out X and Y), it is still possible to manually edit Z easily, without having to re-do all the /save ing
X – east-west direction
Y – north-south direction
Z – height information
X Y Z is mainly used in real life for GPS navigation, while more advanced examples can be the Cartesian coordinate system, or the Three-dimensional space system.
Implementation in SA-MP
pawn Код:
AddPlayerClass(105,2495.3357,-1690.2634,14.7656,4.6488,0,0,0,0,0,0); // Spawned_(CJ's_house_stairs)
AddPlayerClass(105,2494.0784,-1669.0546,13.3359,3.3954,0,0,0,0,0,0); // Moved_(Jumped_5_times_to_North)
AddPlayerClass(105,2473.6648,-1668.8138,13.3174,89.8762,0,0,0,0,0,0); // Moved_(Jumped_5_times_to_West)
AddPlayerClass(105,2513.5305,-1671.1807,13.5250,261.8980,0,0,0,0,0,0); // Moved_(Jumped_5_times_to_East)
NOTE - The starting point of West and East is the point from North, while the starting point of North is from SPAWNED location.
Now, let's simplify the code so that we can only look at the X Y Z locations
pawn Код:
2495.3357,-1690.2634,14.7656; // Spawn
2494.0784,-1669.0546,13.3359; // 5 jumps to North from Spawn
2473.6648,-1668.8138,13.3174; // 5 jumps to West from North
2513.5305,-1671.1807,13.5250; // 5 jumps to East from North
X - 2495.3356
Y - -1690.2634.147656
Z - 14.7656
To be precise, this means
X – east-west direction - 2495.3356
Y – north-south direction - -1690.2634.147656
Z – height information - 14.7656
In even simpler words, it means 2495.3356 east, 1690.2634.147656 south and 14.7656 above sea level.
X means east-west direction
If the location is in -, then it's in west, but if it's in +, then it's in the east. The numbers indicate the DISTANCE from the center of GTA SA i.e the blueberry farm
Y means north-south direction
If it's in -, then it's in south, but if it's +, then it's in the north. The numbers indicate the distance from the center.
Z means height above sealevel.
If it's in -, then it's BELOW sea level, but if it's +, then it's above sealevel. The numbers indicate height above/below sea level.
NOTE - AVOID EDITING COORDINATES MANUALLY FROM INTERIORS
NOTE - SEA LEVEL IS ALWAYS 0 Z
NOTE 2 ^- IF YOU GET COORDINATES INSIDE THE SEA, THE Z CAN DIFFER FROM 0 DUE TO THE DIFFERENT CONDITIONS OF THE WEATHER IN GTA
I hope this helps
P.S - Images from Wiki articles