All GTA SA Object Array -
Pottus - 13.02.2013
A few days ago I was thinking if it would be possible to create an in game RemoveBuildingForPlayer() for my map editor. I knew I would need a list of all the objects in GTA SA and their positions to make it happen so I went ahead extracting all the object data from all the .IPL's processed them into an array.
ENUM
Code:
enum SearchInfo {
Search_Model,
Search_LODModel,
Search_Model_Name[64],
Float:SearchX,
Float:SearchY,
Float:SearchZ,
Float:SearchRX,
Float:SearchRY,
Float:SearchRZ
}
Test position when using test array since it takes a few minutes to compile with the full array list this will help out.
Code:
CMD:testpos(playerid, arg[])
{
SetPlayerPos(playerid, 3.6618,-2594.0713,39.7159);
return 1;
}
There are no LOD objects in the list the object positions have their LODModel counterpart listed so using RemoveBuildingForPlayer() for both model and LODmodel should remove the building.
Known issues:
There are a few objects that might not actually have a LODModel associated but is listed anyways although not very many and really should be so much an issue as these objects are often small components of a house for example that has the same position as house object.
The rotation values may not be 100 percent precise for all objects.
File:
https://www.mediafire.com/?2c8ywc3h1veza4p
Re: All GTA SA Object Array -
Pottus - 13.02.2013
I put this in the wrong section by accident please move to includes thanks.
Re: All GTA SA Object Array -
Jay_ - 13.02.2013
Moved.
Good job - I can think of quite a few uses for this for in game map editing.
Re: All GTA SA Object Array -
MP2 - 13.02.2013
Omg, I totally needed this! Thank you!
Respuesta: All GTA SA Object Array -
CaptainMactavish - 13.02.2013
Very useful, arigatou gozaimasu.
Re: All GTA SA Object Array -
MP2 - 21.02.2013
This takes soooooooooooooo long to compile D: (like 3 minutes!).
Re: All GTA SA Object Array -
Pottus - 21.02.2013
Quote:
Originally Posted by MP2
This takes soooooooooooooo long to compile D: (like 3 minutes!).
|
That is why is there is a test array there, I wish there was a way to compile it quicker I guess it's just the one real con with the array.
Re: All GTA SA Object Array -
Edvin - 21.02.2013
Very useful job!
Re: All GTA SA Object Array -
MP2 - 21.02.2013
Quote:
Originally Posted by [uL]Pottus
That is why is there is a test array there, I wish there was a way to compile it quicker I guess it's just the one real con with the array.
|
Do ANY of the objects actually USE the rx/ry rotation? NONE of them seem to. I guess you could remove them?
EDIT: Hmm, a few (less than 1 percent) use x and y rotation :/
Perhaps it may be an idea to store them in files? Eh idk.
Re: All GTA SA Object Array -
Vince - 21.02.2013
Hint: use const and stock modifiers.
Re: All GTA SA Object Array -
Yashas - 10.02.2014
Compiler gets stuck -.-
I never did anything just included it and created a function getobjinfo which prints(the print() thing :P ) the information.
Re: All GTA SA Object Array -
Pottus - 10.02.2014
It takes a long time to compile but it should finish.
Re: All GTA SA Object Array -
kurta999 - 10.02.2014
Anyway how did you convert the rotation values from quaternion to euler angles?
Re: All GTA SA Object Array -
Pottus - 11.02.2014
Quote:
Originally Posted by kurta999
Anyway how did you convert the rotation values from quaternion to euler angles?
|
Pretty sure this was it
pawn Код:
QuatToEulerZXY(Float:quat_x, Float:quat_y, Float:quat_z, Float:quat_w, &Float:x, &Float:y, &Float:z)
{
x = -asin(2 * ((quat_x * quat_z) + (quat_w * quat_y)));
y = atan2(2 * ((quat_y * quat_z) + (quat_w * quat_x)), (quat_w * quat_w) - (quat_x * quat_x) - (quat_y * quat_y) + (quat_z * quat_z));
z = -atan2(2 * ((quat_x * quat_y) + (quat_w * quat_z)), (quat_w * quat_w) + (quat_x * quat_x) - (quat_y * quat_y) - (quat_z * quat_z));
return 1;
}
Re: All GTA SA Object Array -
kurta999 - 11.02.2014
Quote:
Originally Posted by [uL]Pottus
Pretty sure this was it
pawn Код:
QuatToEulerZXY(Float:quat_x, Float:quat_y, Float:quat_z, Float:quat_w, &Float:x, &Float:y, &Float:z) { x = -asin(2 * ((quat_x * quat_z) + (quat_w * quat_y))); y = atan2(2 * ((quat_y * quat_z) + (quat_w * quat_x)), (quat_w * quat_w) - (quat_x * quat_x) - (quat_y * quat_y) + (quat_z * quat_z)); z = -atan2(2 * ((quat_x * quat_y) + (quat_w * quat_z)), (quat_w * quat_w) + (quat_x * quat_x) - (quat_y * quat_y) - (quat_z * quat_z)); return 1; }
|
I have used this and 70-80% of the rotations was incorrect.
Re: All GTA SA Object Array -
Crayder - 31.03.2014
Is there a way to get Quaternion to Euler angles more correctly? The function you showed above was only correct on a few, which was mostly the angles less than 180^o...
Re: All GTA SA Object Array -
Pottus - 02.04.2014
I'd have to ask Stylock for the correct function yes I was mistaken that one is incorrect.
Re: All GTA SA Object Array -
satafinix - 29.04.2014
Good Work, to userfull
AW: All GTA SA Object Array -
BigETI - 05.05.2014
You could just pre-compute and store all map objects into a file or a database, so the script can gather object information at runtime, by calculating the position of the data inside the file or send a query to a database engine. If you rather want the information to be accessed faster at runtime, but you don't want to wait minutes to compile your script, you could store the data into dynamicly allocated memory at runtime from a file or database while intializing the script.
Re: All GTA SA Object Array -
Toxik - 29.06.2014
how can i use this ?
can i add this to texture studio and remove any object's ?