Transparent to particular objects

Software: Away3D 4.x

JimmyZju, Newbie
Posted: 05 March 2013 02:11 PM   Total Posts: 8

Hi everyone!

I’m new to develop 3D on flash, especially via Away3D. Now I have one hill with two pipelines through it. My question is: how can I make the hill transparent to one pipeline which means I can see the pipeline outside, while obscured to the other (I cannot see it outside)?

Any ideas will be appreciated! Thanks!

   

seti3d, Newbie
Posted: 05 March 2013 02:39 PM   Total Posts: 19   [ # 1 ]

Hi!
I had the same problem changing a single mesh of an imported object. I did it in this way:

...
public class object extends Sprite
{
// embed your 3D-Object in the swf file
  [Embed(source=“thing.awd”, mimeType=“application/octet-stream”)]
  private var importObject : Class;
....
// function to load the awd object
private function objectLoad() : void
{
  Parsers.enableAllBundled();
  AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE, 
  onAssetComplete);
  AssetLibrary.loadData(new importObject() );
}
// asking if loading is complete
private function onAssetComplete(ev:AssetEvent) : void
{
  removeEventListener(AssetEvent.ASSET_COMPLETE, 
  onAssetComplete);
  object = ev.asset as Mesh;
  object.scale(1);
  my_view.scene.addChild(object);
}

There are different possibilities loading objects. But if you want to call a single mesh you should use AWD format.
So - if you want your hill transparent means you have to change its alpha value. You can do it in this way like I did it:

private function changeAlpha( ae : MouseEvent3D) : void
{
  removeEventListener(MouseEvent3D.MOUSE_DOWN, changeAlpha);
// the name you gave the object in your 3D graphics software
// will be used within away3d
  var ch_alpha:Mesh = AssetLibrary.getAsset(“right_hill”) as Mesh;
  if(change_alpha_value == false)
  {
      change_alpha_value = true;
      ColorMaterial(ch_alpha.material).alpha = 0.1;
  }
  else
  {
      change_alpha_value = false;
      ColorMaterial(ch_alpha.material).alpha = 1;
  }
}

I hope this helps a little bit

   

JimmyZju, Newbie
Posted: 05 March 2013 02:59 PM   Total Posts: 8   [ # 2 ]

Thank you for your reply! But you may not understand my need completely. I want the hill be transparent to 1st pipeline while non-transparent to 2nd pipeline. Can you give any further ideas? Thanks again!

   

seti3d, Newbie
Posted: 05 March 2013 03:20 PM   Total Posts: 19   [ # 3 ]

Hi!
That’s exactly the same question I asked not so long time ago. The Mesh (in my example right_hill) is not the object but a single mesh of the object.
If you create an object e.g. with 3DS Max or Blender like a car - then your car is not the mesh. You can call each of your 4 wheels as single meshes, or the antenna or the door.

If you use in your 3D graphics software more than one object for creating your hill so each of the objects is a single mesh with the same name you used to give it in your 3D environment, e.g. hill_left, hill_right or hill_north.
Or did you create your hill with ONE SINGLE OBJECT ?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X