may be its nested into a container as well..
trace(objectContainer3D.children[0] is ObjectContainer3D);
will probably trace true;
if its true, just assign another tmp var and repeat until you get your
mesh.
Its difficult for me to say not knowing your file structure and the
away version
You could also use recursive calls. Look in geom classes how its done.
In Explode line 23 for instance.
Fabrice
On Nov 16, 2009, at 9:58 PM, Flo711 wrote:
Hello Fabrice,
It's an ObjectContainer3D. But I can't acces the mesh...
This line doesn't work : var mesh:Mesh = objectContainer3D.children
[0];
Flash says I can't convert an ObjectContainer3D in a Mesh.
Flo711
if(e.loader.handle is ObjectContainer3D){
trace('ObjectContainer3D');
var objectContainer3D = e.loader.handle as ObjectContainer3D;
var mesh:Mesh = objectContainer3D.children[0];
trace(String(mesh));
}
On 16 nov, 13:06, Fabrice3D <[email protected]> wrote:
Hi flo711,
The loader handle is an Object3D object. It can be a Mesh or an
ObjectContainer3D
If you try to access the faces array stored into a Mesh object make
first make sure its a Mesh since
it can be an Object3DContainer depending on the file structure and/or
the Obj parser version.
if(object3d is Mesh)
trace((object3d as Mesh).faces.length);
if its a container, and it contains only one Mesh
if(object3d is ObjectContainer3D)
var mesh:Mesh = (object3d as ObjectContainer3D).children[0];
trace(mesh.faces.length);
Fabrice
On Nov 16, 2009, at 10:21 AM, Flo711 wrote:
Hello,
I used as exemple the "Lesson_Basic_03_Meshes.fla" with the
turtle to
load an external obj file.
It works but I can't acces the faces of my object. I have added a
function called "onLoaderSuccess". I thought I could get the faces
of
my object by pointing "object3d.faces" but it doesn't work. Can you
help me ?
function onLoaderSuccess(e:LoaderEvent):void
{
var object3d:Object3D = e.loader.handle as Object3D;
trace(String(object3d));
}
I have uploaded the .obj and the .mtl too. Their names are cube.obj
(2) and cube.mtl