I'm having this error below, trying to insert a 3ds Model , in PhysicsVehicleNode:
erro:
SEVERE: Exception
java.lang.NullPointerException
at com.jmex.jbullet.collision.shapes.BoxCollisionShape.createCollisionBox(BoxCollisionShape.java:67)
at com.jmex.jbullet.collision.shapes.BoxCollisionShape.createCollisionBox(BoxCollisionShape.java:63)
at com.jmex.jbullet.collision.shapes.BoxCollisionShape.<init>(BoxCollisionShape.java:27)
at com.jmex.jbullet.nodes.PhysicsNode.createCollisionShape(PhysicsNode.java:582)
at com.jmex.jbullet.nodes.PhysicsNode.<init>(PhysicsNode.java:154)
at com.jmex.jbullet.nodes.PhysicsNode.<init>(PhysicsNode.java:139)
at com.jmex.jbullet.nodes.PhysicsVehicleNode.<init>(PhysicsVehicleNode.java:85)
at TestSimplePhysicsCar.setupGame(TestSimplePhysicsCar.java:211)
at TestSimplePhysicsCar$3.call(TestSimplePhysicsCar.java:300)
at TestSimplePhysicsCar$3.call(TestSimplePhysicsCar.java:1)
at com.jme.util.GameTask.invoke(GameTask.java:140)
at com.jme.util.GameTaskQueue.execute(GameTaskQueue.java:111)
at com.jmex.game.StandardGame.update(StandardGame.java:378)
at com.jmex.game.StandardGame.run(StandardGame.java:250)
at java.lang.Thread.run(Unknown Source)
code is:
physicsCar=new PhysicsVehicleNode(GetCar(),CollisionShape.ShapeTypes.BOX);
physicsCar.setMaxSuspensionTravelCm(500);
physicsCar.setSuspensionCompression(4.4f);
physicsCar.setSuspensionDamping(2.3f);
physicsCar.setSuspensionStiffness(20f);
method
public static Node GetCar(){
if (modelToLoad == null) {
modelToLoad = Fiat500.class.getClassLoader().getResource(
"modelos/fiat500/fiat500.3ds");
}
try {
MaxToJme C1 = new MaxToJme();
ByteArrayOutputStream BO = new ByteArrayOutputStream();
C1.convert(new BufferedInputStream(modelToLoad.openStream()), BO);
r1 = (Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
r1.setLocalScale(.075f);
if (r1.getChild(0).getControllers().size() != 0){
r1.getChild(0).getController(0).setSpeed(20);
}
} catch (IOException e) {
System.out.println("Erro ao ler " );
e.printStackTrace();
System.exit(0);
}
Quaternion temp = new Quaternion();
temp.fromAngleAxis(FastMath.PI / 2, new Vector3f(-1, 0, 0));
//r1.setLocalRotation(temp);
return r1;
}
by google translate