make a transluscent Cube - delete a face of a Cube

Software: Away3D 3.x

achim, Newbie
Posted: 18 June 2011 02:16 PM   Total Posts: 20

Hi
How would you guys do to make a transluscent Cube in Away3d ?
I’ve tried some simple things, but stuff like myCube.alpha=.2 or myCube.blendMode=“whatever” doesn’t seem to work ?
Also, another noob question : how do you delete a particular face of a Cube (to make, say, a box) ?
Thanks!

   

Avatar
theMightyAtom, Sr. Member
Posted: 18 June 2011 02:45 PM   Total Posts: 669   [ # 1 ]

Try material.alpha = 0.2;

Rather then delete a face, you could construct your box using five planes.
That way you’ve also got control over the material on each side separately if necessary.

   

achim, Newbie
Posted: 18 June 2011 04:50 PM   Total Posts: 20   [ # 2 ]

Thanks a lot. I guess this can be applied to a single face, not only to the material ?

   

Avatar
theMightyAtom, Sr. Member
Posted: 18 June 2011 04:54 PM   Total Posts: 669   [ # 3 ]

Well, if you use the 5 planes idea, yes!

   

achim, Newbie
Posted: 18 June 2011 05:03 PM   Total Posts: 20   [ # 4 ]

Thanks.
Well, I speak of different projects though I made only one post.
In the first one, I need to apply transparency to Cubes, to make them look like glass, sort of, so I’d like to know if the alpha can be different from one face to another.
In the second one, I need something like a box, so your idea seems to be very relevant.

   

Avatar
theMightyAtom, Sr. Member
Posted: 18 June 2011 05:12 PM   Total Posts: 669   [ # 5 ]

If I were you I would make a copy of the Cube.as, and call it MyCube.as (remembering to rename the class and constructor), then you can edit that to function just how you like, and you will get an insight into how to build your own primitives in Away3D.

   

achim, Newbie
Posted: 18 June 2011 05:20 PM   Total Posts: 20   [ # 6 ]

Thanks again, I’ll try to do so, or to extend Cube.as, unless it is final.
(cannot check it right now, being at home…)

   

achim, Newbie
Posted: 20 June 2011 08:07 AM   Total Posts: 20   [ # 7 ]

trying to play with alpha on material, I got this error :
1119: Access of possibly undefined property alpha through a reference with static type away3d.materials:Material.
Is there something I am missing ?

   

achim, Newbie
Posted: 20 June 2011 08:34 AM   Total Posts: 20   [ # 8 ]

ColorMaterial(0x98d061,{alpha:.2}) does the job !
But, then, I still don’t know how to access this property dynamically, as I get the same error as above when trying to modify the alpha of a face…

   

az, Newbie
Posted: 25 November 2011 03:57 AM   Total Posts: 1   [ # 9 ]

i have been mapping a transparent png file to the face of a cube to get this effect.
eg:
var transparentSide:BitmapFileMaterial = new BitmapFileMaterial(“images/tranparentSide.png”);
myCube.cubeMaterials.left = transparentSide;

this works dynamically, but it’s probably not the best solution processor-wise - very simple code-wise

   
   
‹‹ tutorials dont appear

X

Away3D Forum

Member Login

Username

Password

Remember_me



X