![]() |
|
[Library] Model Sizes Plus - Object Model Size Database - Printable Version +- open.mp forum (https://forum.open.mp) +-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) +--- Forum: Releases (https://forum.open.mp/forumdisplay.php?fid=13) +---- Forum: Libraries (https://forum.open.mp/forumdisplay.php?fid=31) +---- Thread: [Library] Model Sizes Plus - Object Model Size Database (/showthread.php?tid=176) |
Model Sizes Plus - Object Model Size Database - Crayder - 2019-04-14 Model Sizes Plus! Basically said, this is just the better version of the old one. ____________________________________________________________________________________________________ Major Points:
Note: Don't use this if you already have ColAndreas! Just simply implement the following: Code: stock Float:GetColSphereRadius(objectmodel)
{
new Float:tmp, rad;
if(0 <= objectmodel <= 19999)
{
CA_GetModelBoundingSphere(objectmodel, tmp, tmp, tmp, rad);
return rad;
}
return 0.0;
}
stock GetColSphereOffset(objectmodel, &Float:x, &Float:y, &Float:z)
{
new Float:tmp;
if(0 <= objectmodel <= 19999)
{
CA_GetModelBoundingSphere(objectmodel, x, y, z, tmp);
return 1;
}
return 0;
}Precision difference - Object Model 3511: ![]() Many (most) other objects are affected also. Many even have differences over 100, A couple have differences over 200! Kalcor can't be blamed for these faults though, he extracted the data directly form the game files. ____________________________________________________________________________________________________ Functions: Code: GetColSphereRadius(objectmodel);[/pacoden]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 (for example to set the view distance accordingly). Returns 0.0 on invalid models.
[code]GetColSphereOffset(objectmodel, &Float:x, &Float:y, &Float:z);Code: GetModelBoundingBox(objectmodel, &Float:MinX, &Float:MinY, &Float:MinZ, &Float:MaxX, &Float:MaxY, &Float:MaxZ)Code: GetModelColDimensions(objectmodel, &Float:l, &Float:w, &Float:h)Code: GetColCount();Usage is VERY simple. For model IDs up to 19999, simply use that number as an index in to the data, any other IDs don't exist (but return 0.0): Code: for (new i, c = GetColCount(); i != c; )
{
printf("%f", GetColSphereRadius(i));
new Float:x, Float:y, Float:z;
GetColSphereOffset(i, x, y, z);
printf("%f %f %f", x, y, z);
}____________________________________________________________________________________________________ Credits: Thanks to Y-Less and Kalcor for the original release. It got us by for years! Thanks to Pottus, Chris, and Slice for ColAndreas. Bullet phyiscs' getBoundingSphere function makes this new version possible. ____________________________________________________________________________________________________ Downloads and Links: For database mode go here! (RECOMMENDED FOR SPEED) For regular, advanced version go here! Table of extreme range differences (only above 1). |