changing Parts of imported AWD

Software: Away3D 4.x

seti3d, Newbie
Posted: 08 February 2013 09:25 AM   Total Posts: 19

Hi there!
Does anyone knows - and if so who does - if it is possible to change e. g. the color of a peace of an imported AWD file?

If I import for example an engine complete with the pipelines and so on and want to change the color of one of the pipelines within that imported AWD using AS3 and away3d. Is there any possibility to script something like

    <MASHNAME of imported AWD-file>.pipeline7.alpha = 0.2


Would be very interesting to know if such a possibility exists and if not - when will you guys realize it within away3d. This weekend would be OK for me *lol* (just joking - do I?).

Thanks in advance!

   

Avatar
Fabrice Closier, Administrator
Posted: 08 February 2013 10:33 AM   Total Posts: 1265   [ # 1 ]

of course you can. That you load obj, awd, as3 etc.. once serialized you can access every objects within your project. In this case, using awd, a simple var m:Mesh = AssetLibrary.getAsset(myMeshName);
ColorMaterial(m.material).color = some value; Cast to the type of the asset, material, entity etc that you want to update/change.

   

seti3d, Newbie
Posted: 11 February 2013 03:11 PM   Total Posts: 19   [ # 2 ]

Thanks for your answer.

If I get you correctly than you import the AWD-file machine.awd which will be your mash named m. And this m can be changed.

My intension was to create with 3DS Max a machine with lots of e.g. pipelines (for example named pipeline1 to pipeline20) and export that machine to machine.awd.

This file machine.awd will be imported as Mesh called m.

Is it possible to change pipeline1 of my imported object m like
   
  m.pipeline1.alpha = 0.1; ?

I hope this explanation is a little clearer than in my first post.

   

Avatar
Fabrice Closier, Administrator
Posted: 11 February 2013 09:20 PM   Total Posts: 1265   [ # 3 ]

It was perfectly clear to me on first question.
answer is same too: yes
in my example “m” equals a variable mesh that could be any of the meshes that you want. This applys to any IAsset element that was finalized during parsing.

But you need to use a synthax that is correct for the engine.
m.pipeline1.alpha is what you would do in a flash traditional displaylist context.

As said above, you need to ask the library the object by its id (the mesh “pipeline1”) sinds you know it.
so var myPipe:Mesh = AssetLibrary.getAsset(“pipeline1”);
if you want alter its color or alpha, you need to access the material. a mesh is nothing more than a bunch of numbers defining a geometry in space.

ColorMaterial(myPipe.material).color = 0xFF0000;
would change the color that was stored in awd file by a red color.
You can change all variable that are not specific to ColorMaterial but just doing myPipe.Material.varname = value;
If you need to change properties that are of TextureMaterial type, cast to this type…

I recommand you spend a few hours playing with our examples. You will learn how to access data, and more important for your case, how to define/update materials.

and of course, you may find some answers in here.
http://www.away3d.com/documentation

   

seti3d, Newbie
Posted: 12 February 2013 07:04 AM   Total Posts: 19   [ # 4 ]

Thank you very much Fabrice!
That was perfectly explained and exactly what I was looking for.

   

woodhouse3d, Newbie
Posted: 27 March 2013 11:34 PM   Total Posts: 5   [ # 5 ]

Hi, sorry to jump in on this, but am i right in thinking you can also use a similar method for hiding and un-hiding a mesh within an imported object?

so if using the example given of the machine, you would actually be able to hide one of the pipelines while still displaying the rest of the machine?

this would be particularly useful for adding options on a 3d product viewer.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X