I am trying to put a collision-shape onto my model. But everytime I init the game, I get an NegativeArraySizeException.
private void createSoundBit(float x, float y, float z)
{
Spatial npc1 = assetManager.loadModel("Models/sound/sound.j3o");
npcNode.attachChild(npc1);
CollisionShape noteshape = CollisionShapeFactory.createDynamicMeshShape(npc1);
npcRigid = new RigidBodyControl(noteshape,123.0f);
npcRigid.setFriction(0f);
npcRigid.setMass(60f);
npcRigid.setPhysicsLocation(new Vector3f(x,y,z));
collmanager = new CollManager();
getPhysicsSpace().addCollisionListener(collmanager);
npc1.addControl(npcRigid);
bulletAppState.getPhysicsSpace().add(npcRigid);
rootNode.attachChild(npcNode);
}
I don't know why it happens
Stacktrace:
java.lang.NegativeArraySizeException
at com.jme3.bullet.collision.shapes.HullCollisionShape.getPoints(HullCollisionShape.java:71)
at com.jme3.bullet.collision.shapes.HullCollisionShape.<init>(HullCollisionShape.java:24)
at com.jme3.bullet.util.CollisionShapeFactory.createSingleDynamicMeshShape(CollisionShapeFactory.java:241)
at com.jme3.bullet.util.CollisionShapeFactory.createCompoundShape(CollisionShapeFactory.java:112)
at com.jme3.bullet.util.CollisionShapeFactory.createCompoundShape(CollisionShapeFactory.java:94)
at com.jme3.bullet.util.CollisionShapeFactory.createDynamicMeshShape(CollisionShapeFactory.java:188)
at Main.createSoundBit(Main.java:206)
at Main.simpleInitApp(Main.java:83)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:225)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Thread.java:722)