ShiVa3D
Get Model Size
You feel lost? You don't understand how to use ShiVa?Get Model Size
by DoctorPepper » 14 Apr 2012, 22:55
Searching for a function to return model size in x,y,z.
I am building levels that are created at runtime. The ground is created from blocks with unknown length, height and width.
I can store them as a variable manually, but a much cleaner way would be to get them automatically at runtime. I've tryed object.getScale, but for an unscaled model it is always 1,1,1 no matter the size. Could it be that such function doesnt exist, or did i miss it somewhere?
I am building levels that are created at runtime. The ground is created from blocks with unknown length, height and width.
I can store them as a variable manually, but a much cleaner way would be to get them automatically at runtime. I've tryed object.getScale, but for an unscaled model it is always 1,1,1 no matter the size. Could it be that such function doesnt exist, or did i miss it somewhere?
-

DoctorPepper - Platinum Boarder

- Posts: 411
- Location: Belgium
Re: Get Model Size
by makkar » 14 Apr 2012, 23:05
You won't find a better function then getting the bounding box size. It just changes if the object is rotated, as it gives the Axis Aligned Bounding Box.
http://www.stonetrip.com/developer/doc/api/object-getBoundingBoxMin
Or you can examine the position of each vertex of the object with the mesh api.
http://www.stonetrip.com/developer/doc/api/object-getBoundingBoxMin
Or you can examine the position of each vertex of the object with the mesh api.
Re: Get Model Size
by DoctorPepper » 14 Apr 2012, 23:14
Tnx a lot.
My first concern was that the bounding box might be a little bigger than the model itself. But when tested with a simple shiva box, xmax-xmin gave me a perfect match. Lets hope it gives the same result with models from 3ds max.
My first concern was that the bounding box might be a little bigger than the model itself. But when tested with a simple shiva box, xmax-xmin gave me a perfect match. Lets hope it gives the same result with models from 3ds max.
-

DoctorPepper - Platinum Boarder

- Posts: 411
- Location: Belgium
3 posts
• Page 1 of 1