How to load 3d model at runtime? [Solved]

Software: Away3D 4.x

laurent, Newbie
Posted: 27 October 2011 03:21 PM   Total Posts: 29

Hi,

I am using the latest away3d 4 from GIT. Examples work fine but I am trying to change them to load my 3d model from an URL at runtime instead of embedding them.

I am naively doing the following:

loader = new Loader3D();
var 
request = new URLRequest("yellowCube.3ds");
loader.loadData(requestassetLoaderContext); 

This raises an error.

Is there a way to do it in away3d or should I implement the loading separatly myself and after load my resource?

Thanks!

 

   

eclectrik, Newbie
Posted: 27 October 2011 10:02 PM   Total Posts: 19   [ # 1 ]

In the latest version 4 on github, the loader3d uses `load` rather than `loadData` and the parameters/arguements are slightly different.  So your code would look like:

loader = new Loader3D();
loader.load(new URLRequest("url"),  assetLoaderContext); 

The AssetLibrary is probably a more relevant method of doing it, although i think either will work fine.  Please bear in mind i`m still learning too but hopefully the info is useful!

[edit]

Apologies have edited the load method above - the online docs aren`t updated to the latest Loader3D class ( parameters of the load method are in a different order ).

 

   

laurent, Newbie
Posted: 28 October 2011 09:02 AM   Total Posts: 29   [ # 2 ]

Thanks eclectrik, it works!

I am feeling ashamed… I should I have seen the load function :(

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X