0

基本的に、Three.jsを使用してjavascriptでロボットオブジェクトを作成し、配列を介してロボットパーツを描画するために使用しているthree.jsシーン変数オブジェクトを渡していますが、何らかの理由でシーンオブジェクトが渡されません関数に(描画されません)-JavaScript関数について何か不足していますか?

function Robot(sc){
    this.sc=sc;

    var robtexture = new THREE.MeshLambertMaterial({
        map: THREE.ImageUtils.loadTexture('tex/dmetal.png')
    });

    this.parts = [];

    var current;

    //make body

    current=new THREE.Mesh(new THREE.CubeGeometry(10,15,10), robtexture);

    this.parts.push(current);

    alert("hit");

    //make legs
}

Robot.prototype.draw = function() {
    for (x in this.parts){
        this.sc.add(x);
        alert("hit");
    }
}
4

1 に答える 1