Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when shape gets connected #43

Open
sinsinewave opened this issue Nov 29, 2017 · 1 comment
Open

Crash when shape gets connected #43

sinsinewave opened this issue Nov 29, 2017 · 1 comment

Comments

@sinsinewave
Copy link

sinsinewave commented Nov 29, 2017

Whenever I try to finish a shape manually, the application crashes with java: /var/lib/jenkins/workspace/libgdx/extensions/gdx-box2d/gdx-box2d/jni/Box2D/Collision/Shapes/b2PolygonShape.cpp:158: void b2PolygonShape::Set(const b2Vec2*, int32): Assertion 'false' failed.

Using auto trace to generate shapes works fine, but if you try to move any of the nodes, the same crash occurs.

I'm running Linux x64, Java 1.8.0.

@dlon
Copy link

dlon commented Apr 20, 2018

This error was fixed for me by upgrading libGDX. The crash occurred whenever two adjacent vertices in a polygon were placed near each other (due to an assertion in Box2D related to floating point precision, it seems).

diff --git a/build.gradle b/build.gradle
index 8d2b408..923f09c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -11,8 +11,8 @@ allprojects {
     version = '1.3.1'
     ext {
         appName = 'Physics Body Editor'
-        gdxVersion = '1.6.4'
-        roboVMVersion = '1.5.0'
+        gdxVersion = '1.9.8'
+        roboVMVersion = '2.3.1'
     }

     repositories {
diff --git a/editor/src/main/java/aurelienribon/bodyeditor/maths/Tracer.java b/editor/src/main/java/aurelienribon/bodyeditor/maths/Tracer.java
index 636bb24..9f66d4e 100644
--- a/editor/src/main/java/aurelienribon/bodyeditor/maths/Tracer.java
+++ b/editor/src/main/java/aurelienribon/bodyeditor/maths/Tracer.java
@@ -13,9 +13,8 @@ import com.badlogic.gdx.utils.Array;
  */
 public class Tracer {
     public static Vector2[][] trace(String path, float hullTolerance, int alphaTolerance, boolean multiPartDetection, boolean holeDetection) {
-        Blending blending = Pixmap.getBlending();
-        Pixmap.setBlending(Blending.None);
         Pixmap pixmap = TextureUtils.getPOTPixmap(path);
+        pixmap.setBlending(Blending.None);

         int w = pixmap.getWidth();
         int h = pixmap.getHeight();
@@ -31,7 +30,6 @@ public class Tracer {
         }

         pixmap.dispose();
-        Pixmap.setBlending(blending);

         Array<Array<Vector2>> outlines;
         try {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants