I’m trying to create a solid floor using a geometry box, 30x30. In the tutorial I am using, the author used a loaded model for the scene, but since I am using a jme primitive I need to cast it to a spatial.
sceneModel = (Spatial)floorGeom; CollisionShape sceneShape = CollisionShapeFactory.createMeshShape((Node)sceneModel); RigidBodyControl landscape = new RigidBodyControl(sceneShape, 0); sceneModel.addControl(landscape); rootNode.attachChild(sceneModel);
The first line is the problem line. There really isn’t a reason I’m not creating a model instead for the floor, using a primitive just seems easier at the moment. I get a cannot cast geometry to spacial exception thrown when I run the program, so I am wondering what I could be doing differently?
Edit: I read the error wrong and it is actually the second line which throws the error, cannot cast geomerty to node. So this means that sceneModel is not being casted as a spatial per the first line?