Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Getting Started

Get Model Size

You feel lost? You don't understand how to use ShiVa?

Get Model Size

Postby 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?
User avatar
DoctorPepper
Platinum Boarder
Platinum Boarder
 
Posts: 474
Location: Belgium

Re: Get Model Size

Postby 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.
User avatar
makkar
Platinum Boarder
Platinum Boarder
 
Posts: 1517

Re: Get Model Size

Postby 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.
User avatar
DoctorPepper
Platinum Boarder
Platinum Boarder
 
Posts: 474
Location: Belgium


Return to Getting Started