Accessing containers in an awd file

Software: Away3D 4.x

drbii, Member
Posted: 18 April 2014 04:47 PM   Total Posts: 72

Ok, NEWBIE but making progress.  Making progress in implementing Away3D but having trouble with “controlling” meshes in my awd file.  I have loaded an awd object with a number of containers in it.  One container has lights, and the others are a series of meshes that make up a complex object.  I want to be able to control the sum meshes/containers.  How do I gain focus on those object meshes.  See the attached screen capture of my away3d container structure.

I thought this would be the route to go because I can add my lights and then manipulate the containers/meshes.  Originally I was loading each mesh as separate objects but then ran into the problem that the lights were only affecting one object. 

Which is the better method and how do I get around either problem?  I will need to swap out a mesh with another based on the user’s selection as well.  Will that determine which method I go with.

All of your insights are very helpful and I thank you in advance!!!

 

File Attachments
awayfile.tiff  (File Size: 43KB - Downloads: 182)
   

John Brookes, Moderator
Posted: 21 April 2014 11:50 AM   Total Posts: 732   [ # 1 ]

Use AssetLibrary.getAsset(“ItsName”) with the name of the asset you want
eg
var meshContainer:ObjectContainer3D = ObjectContainer3D(AssetLibrary.getAsset(“myContainerName”));

   

drbii, Member
Posted: 22 April 2014 04:10 AM   Total Posts: 72   [ # 2 ]

Awesome!  That worked great.  If I load an away3d file with a light in it why does it not affect the other containers?

   

rdoi, Member
Posted: 22 April 2014 01:01 PM   Total Posts: 86   [ # 3 ]

The light in away3d is not assigned to all objects by default.
You should assign the lightpicker manually to all materials you want it affect.

   

drbii, Member
Posted: 22 April 2014 01:06 PM   Total Posts: 72   [ # 4 ]

Thanks everyone!  Making progress - with your help!

   

drbii, Member
Posted: 24 April 2014 10:55 PM   Total Posts: 72   [ # 5 ]

Ok.  I’ve got that working but am having trouble getting the lights from a loaded awd to affect the other loaded awd’s. I’ve found plenty of examples of lightpicker being used with lights created at runtime but not with a loaded awe file. 

Thanks!

   

rdoi, Member
Posted: 25 April 2014 02:11 PM   Total Posts: 86   [ # 6 ]

Supposing you are loading awd with AssetLibrary, you should have an ASSET_COMPLETE event listener method. There you get the loaded asset from the AssetEvent parameter.

Just check the asset type (assetEvent.asset.assetType) and make sure you collect (store in an external vector) all assets type LIGHT and MATERIAL you want to affected.

After completing all the loading, just create a global lightpicker, push all collected lights in there, and apply it in all collected material.

Got it?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X