如何在三个js中将布料包裹在3D骨架上?

时间:2019-04-01 06:02:30

标签: javascript arrays node.js three.js

我想在从Collada 3D导入的3D骨架中包裹衣服或添加运动衫。

我已经成功地将3D导入到场景中,但是对如何将云层材料包裹在骨架上一无所知。

        //importing skeleton using colladaloader
        colloader = new THREE.ColladaLoader();
        colloader.load('./assets/skeleton.dae', function (collada) {
        player = collada.scene;
        player.scale.set(20,20,20); 
        player.traverse(function (child) {
            if (child instanceof THREE.Mesh) {
                if (child.material != undefined) {
                    console.log(child.material.name);
                    if (child.material.name == "Body") {
                        child.material.map = texture;
                    }
                }
            }
        });
        scene.add(player);
        });


        //adding a shirt geometry
        var clothTexture = loader.load('./assets/image1.jpg');
        clothTexture.anisotropy = 16;
        var clothMaterial = new THREE.MeshLambertMaterial({
        map: clothTexture,
        side: THREE.DoubleSide,
        alphaTest: 0.9
        });
        var clothMaterial = new THREE.MeshLambertMaterial({
        map: clothTexture,
        side: THREE.DoubleSide,
        alphaTest: 0.9
        });
        var clothGeometry = new THREE.CylinderGeometry( 450, 450 , 680, 92);
        var material = new THREE.MeshBasicMaterial( {color: 0xffff00} );
        var cylinder = new THREE.Mesh( clothGeometry, clothMaterial );
        var cylindermesh = new THREE.MeshBasicMaterial({
        map: clothTexture
        });
        var completeMesh = new THREE.Mesh(clothGeometry, cylindermesh);
        completeMesh.position.set(0, 2500, 0);
        scene.add( completeMesh );

我想要的是在骨架上缠上球衣或衬衫。我该如何进行?

0 个答案:

没有答案