14.04.2015, 22:30
Originally posted by ******, but since he left, I decided to repost it. Credits to Kalcor for the raw object data.
Download:
https://raw.githubusercontent.com/em...modelsizes.inc
There are three functions in this include:
This gets the radius of the collision spheres for all the GTA objects used in SA (including the SA:MP objects); except skins, vehicles, and weapons. The collision sphere entirely encompases the object, so is a good estimator of the size of the object (for example to set the view distance accordingly). Returns 0.0 on invalid models.
This gets the offsets of the collision sphere for all objects. This information is kept in a separate array as it is generally less useful than the sphere radius. It indicates where the centre of the collision sphere is relative to the centre of the object, a position set to minimise the size of the sphere relative to the object. Note that you can't accurately calculate the exact center of the collision sphere without the quaternion rotation of the object, that is why this is a separate "stock" array - so it isn't included in the compiled code if not used.
Gets the total number of models for which collision data is stored:
Usage is VERY simple. For model IDs up to 19901, simply use that number as an index in to the data, any other IDs don't exist (but return 0.0):
Big thanks to Kalcor for dumping the raw data for this out of the game.
Note that due to the sheer volume of data here, the files sets:
To avoid the warning that it gets set anyway.
Download:
https://raw.githubusercontent.com/em...modelsizes.inc
There are three functions in this include:
pawn Код:
forward Float:GetColSphereRadius(objectmodel);
pawn Код:
forward GetColSphereOffset(objectmodel, &Float:x, &Float:y, &Float:z);
pawn Код:
forward GetColCount();
Usage is VERY simple. For model IDs up to 19901, simply use that number as an index in to the data, any other IDs don't exist (but return 0.0):
pawn Код:
for (new i = 0; i != GetColCount(); ++i)
{
printf("%f", GetColSphereRadius(i));
new Float:x, Float:y, Float:z;
GetColSphereOffset(i, x, y, z);
printf("%f %f %f", x, y, z);
}
Note that due to the sheer volume of data here, the files sets:
pawn Код:
#pragma compress 0