How to get the Number of Objects in an OBJ-File

Software: Away3D 4.x

Jokembe, Newbie
Posted: 22 September 2011 10:19 AM   Total Posts: 3

Hey guys,

I’m loading many OBJ-Files with a for-Loop and Xml via AssetLibrary. Now it would be nice, if I can get the number of Objects in the OBJ-File for the testExpression part of the for loop.
It’s very annoying to look in every OBJ-File to count the Objects.

testExpression OBJ.Objects.length
for (var j:uint=0j<testExpressionj++) 

The OBJ:

# 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
# File Created: 16.09.2011 12:28:54

mtllib Gelaende.mtl

#
# object Ground
#

#
# object Wall
#

#
# object Road
#

..... 
   

Richard Olsson, Administrator
Posted: 24 September 2011 01:29 PM   Total Posts: 1192   [ # 1 ]

The only way to do this is to either listen for the objects as they come in (using MESH_COMPLETE on the loader) and count how many times that event fires, or to traverse the loaded container (provided that you’re using a Loader3D to load it) once it has finished loading. If you know that your file is flat, you can simply use myLoader.numChildren, after RESOURCE_COMPLETE has been fired.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X