外观立方体沙

时间:2009-09-22 16:09:27

标签: flash actionscript-3 sandy3d

我是沙滩和动作脚本3的新手。我在沙地网站上关注了一个教程,我创建了一个立方体。

但是我没有成功创建每个立方体面上具有不同纹理的立方体。我的第一个纹理在每张脸上都是重复的。

那么,我怎样才能在每张脸上都有不同的质感?我还没有在沙地网站上找到如何做到这一点。

1 个答案:

答案 0 :(得分:1)

好的伙计们,这是代码:

var materialFace1:BitmapMaterial = new BitmapMaterial( bitmap1.bitmapData );
materialFace1.lightingEnable = true;
var appFace1:Appearance = new Appearance( materialFace1 );

var materialFace2:BitmapMaterial = new BitmapMaterial( bitmap2.bitmapData );
materialFace2.lightingEnable = true;
var appFace2:Appearance = new Appearance( materialFace2 );

var materialFace3:BitmapMaterial = new BitmapMaterial( bitmap3.bitmapData );
materialFace3.lightingEnable = true;
var appFace3:Appearance = new Appearance( materialFace3 );

var materialFace4:BitmapMaterial = new BitmapMaterial( bitmap4.bitmapData );
materialFace4.lightingEnable = true;
var appFace4:Appearance = new Appearance( materialFace4 );

var materialFace5:BitmapMaterial = new BitmapMaterial( bitmap5.bitmapData );
materialFace5.lightingEnable = true;
var appFace5:Appearance = new Appearance( materialFace5 );

var materialFace6:BitmapMaterial = new BitmapMaterial( bitmap6.bitmapData );
materialFace6.lightingEnable = true;
var appFace6:Appearance = new Appearance( materialFace6 );



var box:Box = new Box( "box",100,100,100);


    var face:PrimitiveFace = box.getFace(Box.FACE_LEFT);
    face.appearance = appFace1;

    face = box.getFace(Box.FACE_BOTTOM);
    face.appearance = appFace2;

    face = box.getFace(Box.FACE_FRONT);
    face.appearance = appFace3;

    face = box.getFace(Box.FACE_BACK);
    face.appearance = appFace4;

    face = box.getFace(Box.FACE_RIGHT);
    face.appearance = appFace5;

    face = box.getFace(Box.FACE_TOP);
    face.appearance = appFace6;

此代码允许面部具有不同纹理的立方体。