|
ddddesigns, Jr. Member
Posted: 14 September 2011 07:09 PM Total Posts: 37
I can load a complex .OBJ object without problems. Once I load a simple .OBJ file, my loader has no children. Anyone else having this issue?
public function placeWalls():void { trace('FUNCTION: placeWalls() fired'); Loader3D.enableParser(OBJParser); ALoader = new Loader3D(); ALoader.addEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete); ALoader.parseData(MapBorderOBJData, null, new AssetLoaderContext(false)); ALoader.x = 0; ALoader.z = 0; ALoader.y = 500; ALoader.scaleX = 1; ALoader.scaleY = 1; ALoader.scaleZ = 1; view.scene.addChild(ALoader); // AMaterial = ANormal; }
private function onResourceComplete(event : LoaderEvent) : void { trace('FUNCTION onResourceComplete() fired'); AMaterial = ANormal; var mesh : Mesh; trace('ALoader has ' + ALoader.numChildren.toString() + ' children'); for (var i : int = 0; i < ALoader.numChildren; ++i) { myTrace(i.toString()); mesh = Mesh(ALoader.getChildAt(i)); mesh.geometry.scale(100); mesh.material = AMaterial; } trace('FUNCTION onResourceAComplete() completed'); }
|
ddddesigns, Jr. Member
Posted: 14 September 2011 07:34 PM Total Posts: 37
[ # 1 ]
If anyone else has this problem, here is what I did.
I imported an OBJ that works into my model model that was failing (a building) in 3DS Max. In my case the working model was a model of a soldier. Then I removed most of the polygons from the soldier model and was left with only a hand. I stuck the hand inside a wall of my building so that it will never be seen and exported my model with the hand as an OBJ. It loads!
I realize that it is quite a hack but I still can’t find the cause. This will work for now until the cause is fixed. I hope this helps.
|
liuyi, Member
Posted: 15 September 2011 02:08 AM Total Posts: 65
[ # 2 ]
I got this issue before, and have not resolved it.
|
Richard Olsson, Administrator
Posted: 15 September 2011 04:07 PM Total Posts: 1192
[ # 3 ]
Hi,
Make sure you have the latest version of the away3d-core-fp11 repository and the latest player and playerglobal.swc. If the issue remains, please file an issue report at http://github.com/away3d/away3d-core-fp11/issues and attach the OBJ file that wasn’t working.
Cheers
|
jhocking, Newbie
Posted: 06 October 2011 07:18 PM Total Posts: 12
[ # 4 ]
I was having this issue as well, but managed to work around the problem using information from these two posts in other threads:
http://away3d.com/forum/viewthread/880/#3025
http://away3d.com/forum/viewthread/737/#2291
Basically, it appears that Loader3D sometimes (not every time; sometimes it worked which made the problem even more frustrating) dispatches LoaderEvent.RESOURCE_COMPLETE too soon, resulting in the loader’s number of children still being zero.
What I did instead was to listen for AssetEvent.ASSET_COMPLETE and now it works great. I’m not sure though if this workaround will work with more complex models; mine are very simple OBJ models of boxy spaceships.
|
Chen Hao, Newbie
Posted: 29 November 2011 03:23 AM Total Posts: 2
[ # 5 ]
|
jorson, Newbie
Posted: 19 February 2012 12:34 PM Total Posts: 1
[ # 6 ]
Hey! everyone
I load model by Loader3D,
after LoaderEvent.RESOURCE_COMPLETE,
how should I revise model ‘s material,
loader3D has no material property
|