libGDX:三维动画不工作 [英] libGDX: 3d animation not working

查看:570
本文介绍了libGDX:三维动画不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了使用搅拌机和fbxconv​​一个.g3db动画文件。现在,我的libGDX项目源$ C ​​$ C看起来是这样的:

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();
    }
 }

// [...] 
}

当我打开这个游戏,模型显示了完美的,但有没有动画的。我是比较新的libGDX游戏编程,所以我没有任何想法,我可能已经错了。任何想法?

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?

(我不知道这有什么做什么,但是当我转换使用fbxconv​​ FBX文件,我得到了几个警告,都在寻找这样的:

(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...)

推荐答案

您是否启用OpenGL ES2.0?也有一看:<一href="https://github.com/libgdx/libgdx/wiki/3D-animations-and-skinning">https://github.com/libgdx/libgdx/wiki/3D-animations-and-skinning.您应该提供增量价值animationController.update()。如果你使用搅拌机创建的FBX文件,您可以安全地忽略RRSS警告。

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.

这篇关于libGDX:三维动画不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆