Hello.
I’m trying to serialize a compound created by CollisionShapeFactory#createMeshShape. If I use a simple Spatial like Oto, it works. However, in my application, whatever I do with Spatials lets the engine crash in native code, and I could not find the reason for it. For example, in that Spatial:
package core;
import java.io.File;
import java.io.IOException;
import com.jme3.app.SimpleApplication;
import com.jme3.bullet.util.CollisionShapeFactory;
import com.jme3.export.binary.BinaryExporter;
import com.jme3.scene.Spatial;
import com.jme3.system.JmeContext.Type;
public final class Main extends SimpleApplication {
@Override
public void simpleInitApp() {
try {
final Spatial model = getAssetManager().loadModel("Models/Crashspatial.j3o");
new BinaryExporter().save(CollisionShapeFactory.createMeshShape(model), new File("output"));
} catch (final IOException e) {
throw new RuntimeException(e);
}
stop(false);
}
public static void main(final String[] args) {
new Main().start(Type.OffscreenSurface);
}
}
Current thread (0x0000018827899800): JavaThread "jME3 Main" [_thread_in_native, id=13240, stack(0x0000006ebc500000,0x0000006ebc600000)]
Stack: [0x0000006ebc500000,0x0000006ebc600000], sp=0x0000006ebc5fe570, free space=1017k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [bulletjme.dll+0xdce12]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.jme3.bullet.collision.shapes.infos.BoundingValueHierarchy.serialize(J)[B+0
j com.jme3.bullet.collision.shapes.infos.BoundingValueHierarchy.serialize()[B+6
j com.jme3.bullet.collision.shapes.infos.BoundingValueHierarchy.write(Lcom/jme3/export/JmeExporter;)V+9
j com.jme3.export.binary.BinaryExporter.processBinarySavable(Lcom/jme3/export/Savable;)I+106
j com.jme3.export.binary.BinaryOutputCapsule.write(Lcom/jme3/export/Savable;)V+15
j com.jme3.export.binary.BinaryOutputCapsule.write(Lcom/jme3/export/Savable;Ljava/lang/String;Lcom/jme3/export/Savable;)V+15
j com.jme3.bullet.collision.shapes.MeshCollisionShape.write(Lcom/jme3/export/JmeExporter;)V+21
j com.jme3.export.binary.BinaryExporter.processBinarySavable(Lcom/jme3/export/Savable;)I+106
j com.jme3.export.binary.BinaryOutputCapsule.write(Lcom/jme3/export/Savable;)V+15
j com.jme3.export.binary.BinaryOutputCapsule.write(Lcom/jme3/export/Savable;Ljava/lang/String;Lcom/jme3/export/Savable;)V+15
j com.jme3.bullet.collision.shapes.infos.ChildCollisionShape.write(Lcom/jme3/export/JmeExporter;)V+42
j com.jme3.export.binary.BinaryExporter.processBinarySavable(Lcom/jme3/export/Savable;)I+106
j com.jme3.export.binary.BinaryOutputCapsule.write(Lcom/jme3/export/Savable;)V+15
j com.jme3.export.binary.BinaryOutputCapsule.writeSavableArrayList(Ljava/util/ArrayList;)V+44
j com.jme3.export.binary.BinaryOutputCapsule.writeSavableArrayList(Ljava/util/ArrayList;Ljava/lang/String;Ljava/util/ArrayList;)V+15
j com.jme3.bullet.collision.shapes.CompoundCollisionShape.write(Lcom/jme3/export/JmeExporter;)V+22
j com.jme3.export.binary.BinaryExporter.processBinarySavable(Lcom/jme3/export/Savable;)I+106
j com.jme3.export.binary.BinaryExporter.save(Lcom/jme3/export/Savable;Ljava/io/OutputStream;)V+57
j com.jme3.export.binary.BinaryExporter.save(Lcom/jme3/export/Savable;Ljava/io/File;)V+46
j core.Main.simpleInitApp()V+45
j com.jme3.app.SimpleApplication.initialize()V+282
j com.jme3.system.lwjgl.LwjglWindow.initInThread()Z+112
j com.jme3.system.lwjgl.LwjglWindow.run()V+34
j java.lang.Thread.run()V+11 java.base@11.0.2
v ~StubRoutines::call_stub
siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0xffffffffffffffff
Please, has anybody an idea?