This content has been marked as final. Show 3 replies
You can quickly get the bounding sphere radius of a model using this:
theRadius = scene("myScene").model("car").boundingSphere
Otherwise, if you want the axis-aligned width, length and height, you will have to add the meshdeform modifier, and loop through every vertex.
The closest thing to model's dimensional properties is the model's boundingSphere property. It gives a radius of an imaginary sphere that contains all the vertices of the model; the sphere's diameter is the distance between the two farthest-apart vertices. However it includes the model's children in the sphere. Set yourModel.debug = TRUE to see it.
You could loop through each model, add a mesh deform modifier, go through each mesh[ ].vertexlist, keep track of each max and min x, y, and z value, the calculate w, l, h from that. It would take a little time... you probably wouldn't want to do it every frame. But you could do it on a keypress or something.
I thought I had something like this lying around somewhere. Sure enough, here it is (attached below).