|
Toidas, Newbie
Posted: 20 July 2011 12:08 PM Total Posts: 5
I have tried all the methods I have found to load an .obj file, and I’ve tried to load various different .obj files, one of which was working in an example on the net (http://www.charglerode.com/blog/?p=164). However, none of them seem to be working for me. When the parser gets to the .mtl it seems that it freezes. The message “Loading material file… X of X (or sometimes 0) bytes loaded” stays frozen on the screen. For example, here is the variant with the model from the net: http://tadas.asmeninis.com/teravil/flash/example/ A sni.ppet of the code of the example:
try { var loader3D:Loader3D = Obj.load( "models/m4_sherman.obj", { bothsides:true } ); loader3D.addOnSuccess( onModelLoadSuccess ); view.scene.addChild( loader3D ); } catch( err:Error ) { errorHandle( err ); }
...
protected function onModelLoadSuccess( event:Loader3DEvent ):void { mesh = event.loader.handle; view.scene.addChild( mesh ); }
What’s wrong?
|
John Brookes, Moderator
Posted: 20 July 2011 12:57 PM Total Posts: 732
[ # 1 ]
|
Toidas, Newbie
Posted: 20 July 2011 01:06 PM Total Posts: 5
[ # 2 ]
I’ve noticed it and changed it, but nothing happened. The parser is still freezing. I’ve tried to load the page on Firefox and I got a message: TypeError: Error #1009: Cannot access a property or method of a null object reference.
at away3d.loaders::Obj/parseMtl()
at away3d.loaders::Loader3D/onMtlComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
EDIT: Removing the line referring to texture.jpg in the .mtl made the model to show up. However, the model looks distorted: some faces are missing. (Note that bothsides = true). Now I am pretty sure the problem is caused by the Obj exporter.
|
John Brookes, Moderator
Posted: 20 July 2011 02:11 PM Total Posts: 732
[ # 3 ]
It works with the
tags/3.6.0libs
but not with the
trunk/fp10/away3D
You also will need to flip the faces
Mesh(mesh).geometry.invertFaces();
|
Toidas, Newbie
Posted: 20 July 2011 02:15 PM Total Posts: 5
[ # 4 ]
Thanks for advice, I will check it out.
|
mndexp, Newbie
Posted: 20 July 2011 03:27 PM Total Posts: 10
[ # 5 ]
be sure to check ur mtl file because for some reason 3ds export with absolute path instead of relative… thats solved the problem for me…
|
Toidas, Newbie
Posted: 21 July 2011 06:07 AM Total Posts: 5
[ # 6 ]
Thanks, but I am using Blender, hence the problem should have been somewhere else.
|