[Papervision3D] Changing cube front material
hetsch
gernot.cseh at gmail.com
Mon Nov 12 06:50:38 PST 2007
Hi,
first I want to thank the makers of papervision for this incredible tool.
I'm just playing a little bit with some objects and assigning materials to
them and now I have the problem that I don't know whats the best way to
assign the cube a different front material than the material that was
assigned at initialization.
I use PHUNKY and tried the following:
<code>
var defaultMaterials:MaterialsList = new MaterialsList(
{
front: new ColorMaterial( 0x0000FF, 1, false ),
back: new ColorMaterial( 0xFF0000, 1, false ),
right: new ColorMaterial( 0xFF0000, 1, false ),
left: new ColorMaterial( 0xFF0000, 1, false ),
top: new ColorMaterial( 0xFF0000, 1, false ),
bottom: new ColorMaterial( 0xFF0000, 1, false )
}
);
var c:Cube = new Cube( defaultMaterials, 265, 10, 486 );
scene.addChild( c );
// special movie material
var mat:MovieMaterial = new MovieMaterial( testCube, false, true );
mat.interactive = true;
mat.animated = true;
mat.smooth = true;
mat.doubleSided = false;
// WHY DOESN'T THIS WORK?
//c.materials.materialsByName[ "front" ] = mat;
//c.materials.materialsByName[ "front" ].updateBitmap();
// THIS WORKS, but I think it's not the best way...
c.geometry.faces[ 0 ].material = mat;
c.geometry.faces[ 1 ].material = mat;
</code>
I have uploaded a fla
http://www.nabble.com/file/p13706885/changeMaterial.fla changeMaterial.fla
file which i'm playing with.
Thank's for your help.
--
View this message in context: http://www.nabble.com/Changing-cube-front-material-tf4791528.html#a13706885
Sent from the Papervision3D mailing list archive at Nabble.com.
More information about the Papervision3D
mailing list