Hi! I have loaded a 3DS model and I am trying to get its dimensions
with objectWidth, objectHeight and objectDepth. But I can not get what
I want. I have been looking around and after some changes I got this
code:


                private function loadObjectFile3DS():void
                {
                        var loader:Loader3D = Max3DS.load(urlMueble3D);
                        loader.addOnSuccess(mueble3Dcargado);

                        vivienda.vivienda3D.addChild(loader);
                }

                private function onMouseDown3D(e:MouseEvent3D):void
                {
                        var obj:Object3D = (e.object as Mesh);
                        trace("obj.objectWidth  ="+obj.objectWidth);
                        trace("obj.objectHeight ="+obj.objectHeight);
                        trace("obj.objectDepth  ="+obj.objectDepth);
                }
                private function mueble3Dcargado(e:Loader3DEvent):void
                {
                        mueble3D = e.loader.handle;
                        mueble3D.x = x;
                        mueble3D.z = y;
                        mueble3D.rotationX = 90;
                        mueble3D.scale(scale);
                        mueble3D.addOnMouseDown(onMouseDown3D);

                        trace("mueble3D.objectWidth  ="+mueble3D.objectWidth);
                        trace("mueble3D.objectHeight ="+mueble3D.objectHeight);
                        trace("mueble3D.objectDepth  ="+mueble3D.objectDepth);
                }

And this is what I get in the console:
mueble3D.objectWidth  =171.981314055985
mueble3D.objectHeight =171.981314055985
mueble3D.objectDepth  =171.981314055985
obj.objectWidth  =54
obj.objectHeight =75.00000059604645
obj.objectDepth  =9.999999046325684

As you can see, the dimensions of both are not the same, why is that?
And how can I get the right dimensions without a MouseDown event? I'm
not very used to away3D, and maybe I am doing something wrong, but I
would like to know what it is.


Thanks in advance,
Irati

Reply via email to