How to embed and then use an OBJ or AWD object?

Software: Away3D 4.x

Mr Margaret Scratcher, Sr. Member
Posted: 04 July 2012 03:06 PM   Total Posts: 344

Hi there,

I have a fair amount of experience of loading and then using .obj objects, but I’ve never embedded them into the flash itself.

The only bit of code I can find is in the SSSShading example in the Broomstick release examples.

In that you have

[Embed(source="/../embeds/head/head.obj"mimeType="application/octet-stream")]
  
private var OBJ : Class; 

at the top, as usual, and then later:

ResourceManager.instance.addEventListener(ResourceEvent.RESOURCE_RETRIEVEDonResourceRetrieved)
   
_container ObjectContainer3D(ResourceManager.instance.parseData(new OBJ(), "head"true)); 

but there doesn’t seem to be a Resourcemanager in away3d any more…

(It used to be import away3d.loading.ResourceManager; )

   

Richard Olsson, Administrator
Posted: 04 July 2012 04:41 PM   Total Posts: 1192   [ # 1 ]

Use the loadData() method on Loader3D, AssetLoader or AssetLibrary depending on which type of loading you want to perform. If the file has dependencies, it will try to load them from the URLs that are specified in the OBJ file. If you’re embedding the OBJ you probably want to embed the dependencies too. Then you can use the AssetLoaderContext.mapUrlToData() method to re-map those URLs to other embedded files.

I explained this in another thread (and several more threads as well, I believe, so you can just google for more examples): http://away3d.com/forum/viewthread/2665/

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X