1

I've created a .g3db animation file using Blender and fbxconv. Now, my libGDX project source code looks something like this:

public class test implements ApplicationListener {
// ...
 public ModelInstance fred
 public AnimationController animationController;

 public void create () {
    modelBatch = new ModelBatch();
    // ... 

    assets = new AssetManager();
    assets.load("data/fred.g3db", Model.class);
    loading = true;
 }

 private void doneLoading() {
    Model fredData = assets.get("data/fred.g3db", Model.class);

    fred = new ModelInstance(fredData);
    animationController = new AnimationController(fred);
    animationController.animate(fred.animations.get(0).id, -1, 1f, null, 0.2f);

    loading = false;
 }

 public void render () {
    if (loading && assets.update())
        doneLoading();
    camController.update();

    Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    if(!loading) {
    animationController.update(10);
        modelBatch.begin(cam);
        modelBatch.render(fred,lights);
        modelBatch.end();
    }
 }

// [...] 
}

When I open this game, the model shows up perfectly, but there's no animation at all. I'm relatively new to libGDX game programming, so I have no ideas where I could have gone wrong. Any ideas?

(I don't know if this has something to do with anything, but when I converted the fbx file using fbxconv, I got several warnings, all looking like this:

WARNING: Node XXX uses RrSs mode, transformation might be incorrect.

But if what I read about this warning is true, it shouldn't actually cause any problems...)

4

2 回答 2

6

Did you enable OpenGL ES2.0? Also have a look at: https://github.com/libgdx/libgdx/wiki/3D-animations-and-skinning. You should provide the delta value to animationController.update(). If you used blender to create the FBX file, you can safely ignore the RrSs warning.

于 2013-09-23T18:37:26.043 回答
0

Quoting from here,

Don't drag and drop your fbx file on fbx-conv, it will not work for most scenarios.

于 2017-02-22T07:59:51.860 回答