物理体编辑器错误 [英] Physics Body Editor error

查看:16
本文介绍了物理体编辑器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从此库初始化 BodyEditorLoader 时出现此错误 http://www.aurelienribon.com/blog/projects/physics-body-editor/

I get this error when trying to initialize BodyEditorLoader from this library http://www.aurelienribon.com/blog/projects/physics-body-editor/

    Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.UnsatisfiedLinkError: com.badlogic.gdx.physics.box2d.PolygonShape.newPolygonShape()J
        at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:127)
    Caused by: java.lang.UnsatisfiedLinkError: com.badlogic.gdx.physics.box2d.PolygonShape.newPolygonShape()J
        at com.badlogic.gdx.physics.box2d.PolygonShape.newPolygonShape(Native Method)
        at com.badlogic.gdx.physics.box2d.PolygonShape.<init>(PolygonShape.java:29)
        at aurelienribon.bodyeditor.BodyEditorLoader.<init>(BodyEditorLoader.java:31)

我该如何解决?

推荐答案

基于此https://github.com/libgdx/libgdx/issues/2393 问题是因为在创建形状之前没有加载本地人.

Based on this https://github.com/libgdx/libgdx/issues/2393 the problem is because natives aren't loaded before creating shape.

有两种解决方案:

首先是在创建任何形状之前创建 World 实例.

First is creating World instance before creating any shapes.

其次是在创建任何形状之前调用 Box2D.init();.首选这种方法,因为您不需要创建 World 实例,而且更明显.

Second is calling Box2D.init(); before creating any shapes. This method is preferred because you don't need to create World instance and it's much more obvious.

使用此版本 https://gist.github.com/grulg/8691e7ee7709367ce165 代替来自 Google 代码的版本.

Use this version https://gist.github.com/grulg/8691e7ee7709367ce165 instead of version from Google Code.

这篇关于物理体编辑器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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