2009-09-22 52 views
1

我是一個沙質和動作腳本的新手3.我跟着沙網站上的教程,我創建了一個多維數據集。外觀多維數據集沙

但我沒有成功創建每個立方體表面上具有不同紋理的立方體。我的第一個紋理是在每張臉上重複的。

那麼,我怎麼能在每張臉上有不同的紋理?我還沒有找到如何在沙網站上做到這一點。

回答

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; 

此代碼允許有不同的紋理由面立方體。