Bullet-native, fatal error

Hello,
since I’ve switched from jbullet to native bullet when I try to create the CollisionShape of certain nodes the application crashes and i get this error
[java]

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0x00007f11a8b156b6, pid=19971, tid=139713814628096

JRE version: Java™ SE Runtime Environment (8.0-b132) (build 1.8.0-b132)

Java VM: Java HotSpot™ 64-Bit Server VM (25.0-b70 mixed mode linux-amd64 compressed oops)

Problematic frame:

C [libbulletjme64.so+0x11b6b6] btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleIndexCallback*, btVector3 const&, btVector3 const&) const+0x356

Core dump written. Default location: /st/projects/Game/core or core.19971

An error report file with more information is saved as:

/st/projects/Game/hs_err_pid19971.log

If you would like to submit a bug report, please visit:

http://bugreport.sun.com/bugreport/crash.jsp

[/java]
I would point out that I can create the CollisionShape of the same model with jbullet without getting any kind of error.

The same happens when I load a PhysicsControl previously created with the sdk.

Trying to figure out the problem, I’ve built this simple scene (Flat.j3o)
LINK

composed of a flat terrain made with the SDK (that loads correctly) and this cube
LINK

made with blender (that causes the error).

For loading the PhysicsControls into the game I’m using this code:
[java]
public static void loadPhysics(Spatial s){
try{
Node ns=(Node)s;
for(Spatial n:ns.getChildren())loadPhysics(n);
}catch(Exception e){}
for(short i=0;i<s.getNumControls();i++){
Control c=s.getControl(i);
if(c instanceof PhysicsControl)BULLETAPPSTATE.getPhysicsSpace().add©;
}
}

[/java]

I wish someone could help me.

I’ve also got this error some time ago, but I don’t have a solution for it. There was also an old thread about this topic, but I don’t know if I can find it.

What I do as workaround is to make a custom control that creates a box collision shape at runtime. You can attach this custom control in the scene composer to a node.

I have found the old thread. You should search for “btStridingMeshInterface”:
http://hub.jmonkeyengine.org/forum/topic/meshcollisionshape-causes-signal-11-crash/

I must admit that I haven’t tried what @Empire Phoenix suggested, but the error also occurs with only a simple cube.

Thanks for the reply.
I can’t use your workaround because I need the collisionshape for a complex mesh, so I think I will keep using jbullet insted of the native one.

Hi,

I’ve got the same issue. I tried to follow @EmpirePhoenix advice from Thread linked previously : I check every spatial (the loaded j3o + created by code) with the following code :

[java]
public static boolean checkIndexesOfPosition(Spatial s) {
boolean b = true;
if (s instanceof Geometry) {
b = checkIndexesOfPosition(((Geometry) s).getMesh());
}
if (s instanceof Node) {
for(Spatial child : ((Node)s).getChildren()) {
b = b && checkIndexesOfPosition(child);
}
}
return b;
}

public static boolean checkIndexesOfPosition(Mesh m) {
    boolean b = true;
    IndexBuffer iis = m.getIndexBuffer();
    VertexBuffer ps = m.getBuffer(VertexBuffer.Type.Position);
    Buffer psb = ps.getDataReadOnly();
    b = b &amp;&amp; (psb.remaining() == (ps.getNumElements() * 3) + ps.getOffset()); // 3 float
    if (!b) System.out.printf("%d != %d * %d : psb.remaining() == ps.getNumElements() * 3 \n", psb.remaining(), ps.getNumElements());
    //VertexBuffer ips = m.getBuffer(VertexBuffer.Type.Normal);
    for(int ii = 0; b &amp;&amp; ii &lt; iis.size(); ii++) {
        int i = iis.get(ii);
        b = b &amp;&amp; i &lt; ps.getNumElements() &amp;&amp; i &gt; -1;
        if (!b) System.out.printf("-1 &lt; %d &lt; %d : i &lt; ps.getNumElements()\n", i, ps.getNumElements());
    }
    return b;
}

[/java]

But every model pass the check. May be I did something wrong in the check code ??

I run the check with jbullet, else, with bullet, the jvm crash on asset.loadModel. May be because model include RigidBody.

Any advice ?

Hey man, did you find any solution? Was it a android build?

Welcome to the JME Forum, @Pietro_Firmino

I see you’ve revived a 9 year-old Forum topic. If the website encouraged you to do this, then I apologize on its behalf; it may be misconfigured.

A lot has changed in 9 years. If you’re looking for troubleshooting help, you’ll probably get better response by starting a fresh topic.

1 Like