#
luxiaotao1123
2023-03-06 8f902a43cd8fb6e07605d2db7e35eaaa2f540879
static/js/object/DefineModel.js
@@ -2,11 +2,38 @@
export class DefineModel {
    object;
    mixer;
    constructor(object) {
        this.object = object;
        let that = this;
        that.object = object;
        that.mixer;
        const loader = new FBXLoader();
        // loader.load( '../static/model/fbx/fbxDemo.fbx', function ( object ) {
        loader.load( '../static/model/fbx/Samba Dancing.fbx', function ( object ) {
            that.mixer = new THREE.AnimationMixer( object );
            const action = that.mixer.clipAction( object.animations[ 0 ] );
            action.play();
            object.traverse( function ( child ) {
                if ( child.isMesh ) {
                    child.castShadow = true;
                    child.receiveShadow = true;
                    child.material = new THREE.MeshLambertMaterial({
                        color: 0xCD6839
                    });
                }
            } );
            that.object.addObject( object );
        } );
    }