HI al,
If I try to run the jme3 hello collision tutorial I get following error:
[java]ava.lang.ClassCastException: com.jme3.scene.Geometry
at hellojme3.Main.simpleInitApp(Main.java:56)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:187)
at com.jme3.app.SimpleBulletApplication.initialize(SimpleBulletApplication.java:52)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:134)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:183)
at java.lang.Thread.run(Thread.java:613)[/java]
And I get the error in this part:
[java] assetManager.registerLocator(“Model/”, FileLocator.class.getName());
scene = assetManager.loadModel(“X.obj”);
scene.scale(0.1f, 0.1f, 0.1f);
rootNode.attachChild(scene);
DirectionalLight light = new DirectionalLight();
light.setDirection(new Vector3f(1, -1, -1));
light.setColor(ColorRGBA.White.clone());
rootNode.addLight(light);
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
CompoundCollisionShape sceneShape = CollisionShapeFactory.createMeshCompoundShape((Node) scene);
PhysicsNode landscape = new PhysicsNode(scene, sceneShape, 0);
[/java]
I don’t understand what’s the error?
you try to put something that is a Geometry into something that is not, at line 56 of your class.
what is line 56?
line 56:
CompoundCollisionShape sceneShape = CollisionShapeFactory.createMeshCompoundShape((Node) scene);
And the scene Object is a Geometry?
If so…you try to cast a geometry into a node…thus the error.
try to create a node object, attach the scene object to it , then attach the node to the rootNode and use it for your compound shape.
Why make it a node in the first place? A Geometry is fine…