我正在尝试移动使用libGDX加载的模型的某些节点。
这是代码:

public void render() {
    ...

    if (loading && assets.update())       //done when app starts
        doneLoading();

    if(!loading)
        moveModel();

    modelBatch.begin(cam);
    modelBatch.render(instances, environment);
    modelBatch.end();
}

private void doneLoading() {
       I_model = assets.get("data/model.g3db", Model.class);
       I_instance = new ModelInstance(I_model);
       instances.add(I_instance);
       loading = false;
}

private void moveModel(){
    for(int i=0;i<MAX_VALUE;i++){
        Node bone = I_instance.getNode(names[i]);
        if(bone != null){
            bone.rotation.set(new Vector3(1, 1, 0), values[i]);
        }
    }
    I_instance.calculateTransforms();
    instances.add(I_instance);
}


该模型已正确显示,但完全没有移动。
有什么建议么?

最佳答案

您应该只修改ModelInstance的transform
您的情况是I_instance.transform.translate(...)

08-18 09:29
查看更多