access submeshes in OBJ file 3.6

Software: Away3D 3.x

Avatar
Choons, Sr. Member
Posted: 08 July 2011 07:45 PM   Total Posts: 281

Hi - been forced to work with OBJ files for a job. I need to parse in a tshirt model that has front, back, right sleeve, left sleeve, etc. in the OBJ file. I’m used to parsing 3ds models like:

myObjContainer3D = Max3DS.parse(Cast.bytearray(FullModel), { autoLoadTextures:false } );

and then getting access to each part of the model like

for each (var child:Mesh in myObjContainer3D.children) {
    // do something like assign different materials
}

I tried:

myObjContainer3D = Obj.parse(Cast.string(FullModel)

but it throws an error about casting type Object3D to ObjectContainer3D. So how do I parse an OBJ file where I can get access to each named mesh inside it so I can assign different materials to each?

   

Avatar
Choons, Sr. Member
Posted: 08 July 2011 08:32 PM   Total Posts: 281   [ # 1 ]

also, I don’t get why if you trace a loader or loader.children you don’t get a report on its type but some weird crap like $: x:0 y:0 z:0

   

Avatar
Choons, Sr. Member
Posted: 09 July 2011 03:35 AM   Total Posts: 281   [ # 2 ]

ah I got it. it needs to be

loader = new Loader3D();
loader = Obj.load(”../some.obj”);
loader.addOnSuccess(buildShirt);

then in that function-

myObjContainer3D = event.loader.handle as ObjectContainer3D; // <—-

for each (var child:Mesh in myObjContainer3D.children) {
    // do something
}

   
   
‹‹ TextField3D

X

Away3D Forum

Member Login

Username

Password

Remember_me



X