[Include] Model Sizes
#1

https://gist.github.com/raw/4543512/...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:

Code:
#pragma compress 0

To avoid the warning that it gets set anyway.

Quote:
Originally Posted by Babul
yeah, thats what we need: being able to feed the streamer with procedural created stream distances - cool, when it works - thanks
Quote:

@[MM]18240[FMB]: no, that little include lets you get any objects "size", its collision radius sphere. so if you have an object like the little ramp 1665, you can consider its radius returned as 6.0.
the "40 meter road" object should return a value close to 21.0?
if you take each objects size into account when reading maps, you can work with the object modelid DIRECTLY in order to tell the streamer wether to stream it from a far distance (a 40 meter long road equals a 20.0 meter radius. multiply that 20.0 by 25, you get 500.0 meters stream/draw distance).
taking a little object like a chair, table, or anything with a smaller radius like 4.0 meters, multplied by 25 again, results in only 100 meters to stream.
whats the trick?
that "bias" value of 25, set up PROPERLY, will result in a dynamic streaming process, therefore the "important" objects for racing (streets) gets streamed from far away, while "redundant" objects gets streamed locally, in a small radius only.
benefit: HUGE maps visible from a wide distance due to ignoring less important objects!
addition: it can reduce networth bandwidth aswell.

mmmkay, was that clear? heh

__________________

Originally by ******. (I have directly restored the thread from his previous thread, however some of the BBCode may be a little messed up).

Download here:
https://gist.githubusercontent.com/Y...modelsizes.inc

or incase that for some reason gets removed
https://evanabagail.net/files/modelsizes.inc
Reply


Messages In This Thread
Model Sizes - by Abagail - 14.04.2015, 22:26
Re: Model Sizes - by iSkyline - 15.04.2015, 16:23
Re: Model Sizes - by Crayder - 23.04.2015, 23:38
Re: Model Sizes - by Abagail - 24.04.2015, 14:03
Re: Model Sizes - by Crayder - 24.04.2015, 23:27
Re: Model Sizes - by Abagail - 26.04.2015, 02:58
Re: Model Sizes - by Pottus - 27.04.2015, 02:45
Re: Model Sizes - by Crayder - 27.04.2015, 03:33
Re: Model Sizes - by Pottus - 27.04.2015, 03:39
Re: Model Sizes - by vermaritt - 27.04.2015, 15:50
Re: Model Sizes - by Mutha_X - 27.04.2015, 16:12
Re: Model Sizes - by Pottus - 27.04.2015, 17:56
Re: Model Sizes - by Baltazar - 31.05.2015, 19:14
Re: Model Sizes - by Crayder - 01.06.2015, 00:10
Re: Model Sizes - by Abagail - 01.06.2015, 00:20
Re: Model Sizes - by Baltazar - 01.06.2015, 20:24
Re: Model Sizes - by Crayder - 03.06.2015, 17:08
Re: Model Sizes - by Baltazar - 03.06.2015, 20:23
Re: Model Sizes - by Crayder - 05.06.2015, 06:19

Forum Jump:


Users browsing this thread: 2 Guest(s)