Assertion error in GImpactCollisionShape

Well what exactly could cause this error:



Exception in thread "main" java.lang.AssertionError
   at com.bulletphysics.extras.gimpact.GImpactMeshShape.lockChildShapes(GImpactMeshShape.java:170)
   at com.jme3.bullet.collision.shapes.GImpactCollisionShape.createShape(GImpactCollisionShape.java:129)
   at com.jme3.bullet.collision.shapes.GImpactCollisionShape.createCollisionMesh(GImpactCollisionShape.java:79)
   at com.jme3.bullet.collision.shapes.GImpactCollisionShape.<init>(GImpactCollisionShape.java:66)
   at online.newhorizons.server.PhysicShape.get(PhysicShape.java:27)
   at online.newhorizons.server.entity.terrain.STerrain01.<init>(STerrain01.java:18)
   at online.newhorizons.server.system.SSolarSystem.<init>(SSolarSystem.java:126)
   at online.newhorizons.server.Starter.main(Starter.java:27)



I try to:
Geometry cshape = (Geometry)mdl.getChild(0);
cache.put(name,new GImpactCollisionShape(cshape.getMesh()).getCShape());
if I use a MeshCollisonShape, for example, the same way, I get no error.

What does your cache.put method do? Its just a hashmap or smth I guess? Why do you access the bullet collision shape inside the GImpact shape? If you wanna reuse it, just use the GImpactCollisiomShape object? Assertion error could also be because of the mesh itself, it should be "closed".

Actually after some resarch in the jbullet code it is a function that is containing assert(false)

it seems that lockChildShapes shouldn't be called at all.

Empire Phoenix said:

Actually after some resarch in the jbullet code it is a function that is containing assert(false)
it seems that lockChildShapes shouldn't be called at all.

Well that something is wrong is for sure, question is why does bullet think it has to call it? Did you try another mesh? Do you do anything else on the native bullet object since you already pull it from the jme3 object (which again, you shouldnt do)?

Nope i can#t do anything with it, since it does not reach the end of its constructor, error seems to be in the GImpactShapetype



   protected void createShape() {
        bulletMesh = new IndexedMesh();
        bulletMesh.numVertices = numVertices;
        bulletMesh.numTriangles = numTriangles;
        bulletMesh.vertexStride = vertexStride;
        bulletMesh.triangleIndexStride = triangleIndexStride;
        bulletMesh.triangleIndexBase = triangleIndexBase;
        bulletMesh.vertexBase = vertexBase;
        bulletMesh.triangleIndexBase = triangleIndexBase;
        TriangleIndexVertexArray tiv = new TriangleIndexVertexArray(numTriangles, triangleIndexBase, triangleIndexStride, numVertices, vertexBase, vertexStride);
        cShape = new GImpactMeshShape(tiv);
        cShape.setLocalScaling(Converter.convert(worldScale));
        ((GImpactMeshShape)cShape).updateBound();
        ((GImpactMeshShape)cShape).lockChildShapes(); ///////////////////////////////////////HEREHEREHERE
        cShape.setLocalScaling(Converter.convert(getScale()));
    }
[/code

Ah, ok… Thats still in because I had problems after loading at first and did not know why, so I was trying around. Thanks, I'll remove that call.