redcamel / RedGL2

RedGL - Javascript 3D library (webgl)
https://redcamel.github.io/RedGL2/example
MIT License
155 stars 16 forks source link

How to switch animation of Fox.gltf model #701

Closed cx20 closed 2 years ago

cx20 commented 4 years ago

I tried to display Fox.gltf using RedGL. Fox.gltf contains three animations (Survey, Walk, and Run). However, I did not know how to switch it.

RedGL + Fox.gltf result: By default, the Survey animation is played. image

I want to play the Run animation, but I don't know how. I'm glad if you get some advice.

redcamel commented 4 years ago

@cx20 parsingResult内部のanimations配列を利用してください切り替えは可能です。

RedGLTFLoader(
    this, assetPath + 'glTF/basic/AnimatedMorphCube/glTF/',
    'AnimatedMorphCube.gltf', 
    function (v) {
        console.log(v.parsingResult) // check this! 
        // v.stopAnimation() 
    // v.playAnimation(v.parsingResult.animations[0])
    tScene.addChild(v['resultMesh'])
    }
);
cx20 commented 4 years ago

Hmm, I tried to select the Run animation in Fox.gltf but it didn't seem to switch.

https://github.com/cx20/gltf-test/blob/master/examples/redgl2/index.js#L89-L90

RedGLTFLoader(
    this, // redGL
    base, // assetRootPath
    file, // fileName
    function (v) { // callBack
        v['resultMesh'].scaleX = scale;
        v['resultMesh'].scaleY = scale;
        v['resultMesh'].scaleZ = scale;

        if (modelInfo.name == "Fox") {
            v.stopAnimation();
            v.playAnimation(v.parsingResult.animations[2]);  // "Run"
        }

        tScene.addChild(v['resultMesh']);
    },

RedGL + Fox.gltf result:

redcamel commented 4 years ago

@cx20 ロードした後プレイ管理側のバグを発見した。 いつがから発生したとみられ、今日夜遅くでも修正しておきました。いつも良いフィードバックありがとうございます。

cx20 commented 4 years ago

@redcamel

I'm trying the libraries in the release folder but the situation doesn't seem to change. The modified date of the file is 2020.03.18. Isn't it the latest version? https://github.com/redcamel/RedGL2/blob/dev/release/RedGL.js

Do I need to build the latest version?