[Include] Model Sizes
#1

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:

pawn Код:
forward Float:GetColSphereRadius(objectmodel);
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.

pawn Код:
forward GetColSphereOffset(objectmodel, &Float:x, &Float:y, &Float:z);
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.

pawn Код:
forward GetColCount();
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):

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);
}
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:

pawn Код:
#pragma compress 0
To avoid the warning that it gets set anyway.
Reply
#2

Lol, you and Abagail's was at like the same time.

4 minute difference! What a fucking coincidence!
Reply
#3

Sorry but I already posted this.
Reply
#4

Quote:
Originally Posted by Crayder
Посмотреть сообщение
Lol, you and Abagail's was at like the same time.
Had a problem with the link so there was a delay.
Reply
#5

What if I want to generate my own collision array? What tool (code?) do I use to extract info from .col files?
Reply
#6

Quote:
Originally Posted by Baltazar
Посмотреть сообщение
What if I want to generate my own collision array? What tool (code?) do I use to extract info from .col files?
Depends, what are you trying to extract? All collision shit? Why not use ColAndreas? The ColAndreas wizard can extract stuff, check out it's source if you insist.
Reply
#7

Compare this to what ColAndreas returns you will see it is not really accurate.
Reply
#8

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Compare this to what ColAndreas returns you will see it is not really accurate.
Speaking of, I generated an entirely new modelsizes.inc using ColAndreas. Only thing it needs is the SA-MP objects.

https://www.dropbox.com/s/v1g5kfvjt5...sizes.inc?dl=0

https://sampforum.blast.hk/showthread.php?pid=3464980#pid3464980
Reply
#9

Now with SA-MP objects and extremely precise data:

https://www.dropbox.com/s/v1g5kfvjt5...sizes.inc?dl=0

EDIT: Check this shit out, I was just looping through all objects to check my version vs the old version and found some extensive faults. There were many objects that had differences of over 50 and some over 100 (one over 200 that I seen). Below is just one of few, I chose it to represent because it it's difference can fit well on a screen shot. I projected a green sphere over my version and a red over the old.


If you want to test that object yourself it's model 3511.
Off-topic, look at the bird in my screenshot, he's right in the spotlight.
Reply
#10

I noticed this too the original model sizes had little bearing over the actual model size.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)