I'm definitely finding the file because I can load the model alone in the visual world with no problem. The set-up in the physics world is the problem.
Now I've just tested a BUNCH of stuff and my results are below. Basically I'm using the physicsCar example, and replacing the Box stand-in alone with the model of my robot. I am keeping the wheels from the original code. Here are my tests and results:
–When loading a COLLADA model of my robot, I can't simply call findGeom with no String name, it only returns the first mesh it finds, which is a small component of the robot model. It still gives me the MATERIALS errors as in the last post, but doesn't fully crash. When I do a System.out.println(car.getChildren()); I get the following only: "[Model (Node), Camera (Node)]"
–I can load a .OBJ of the car directly as a Geometry, but I have to apply the materials myself and I still can't seem to get the physics of this working correctly. I have to Greatly reduce the scale of the model when I import it as a OBJ. I'll have to look into whether this is something I can change in the CAD program before exporting. This seems to REALLY mess with the Collision shape. Even when I scale the Geometry of the model, it seems to only occur in the visual world, the physics model is not scaled. This is my code for that section:
Geometry car = (Geometry) assetManager.loadModel("dependencies/body_only.obj");
car.setLocalScale(0.25f, 0.25f, 0.25f);
// show normals as material
car.setMaterial(mat);
rootNode.attachChild(car);
car.setModelBound(new BoundingBox());
BoundingBox box = (BoundingBox) car.getModelBound(); //USE THIS WITH OBJ
final Vector3f extent = box.getExtent(null);
CompoundCollisionShape compoundShape = new CompoundCollisionShape();
compoundShape.addChildShape(new BoxCollisionShape(extent), Vector3f.UNIT_Y);
player = new PhysicsVehicleNode(car, compoundShape, 400);
–I tried to load an OGRE mesh XML of the robot model, but when I attempt to apply the physics using the findGeom with no name String, the entire model is SHOWN, however only that same small component (the first mesh in the file I suppose) is in the physics space. It is the same problem as with the COLLADA file. When I do a System.out.println(car.getChildren()); I get the following only: "[Flat_robot-geom-1 (Geometry), Flat_robot-geom-2 (Geometry)]"
====DebugShape Tests (Strange Problems)====
–When I attempt to attachDebugShape to a PhysicsNode built around the imported models, I get all kinds of problems. I simply added the following code to each of my tests, OBJ, OGREmesh and COLLADA imports. Here is that code:
player = new PhysicsVehicleNode(car, compoundShape, mass); //actual vehicle
PhysicsNode lala = new PhysicsNode(chasis, compoundShape, mass);//tests node to see BoundingBox
lala.attachDebugShape(assetManager)
rootNode.attachChild(lala);
*with the OBJ, and the code above, I get my model where it needs to be. But if I add ANY mass, the model shoots off the screen straight up incredibly fast. The debug shape is huge, the size of the original model (as mentioned above)
*With this code in the COLLDAD test, only the small component mentioned earlier is shown. The debugShape is the same size as the part of the model, but again is translated up by about 1 world-unit. Attempting to drive the robot makes the robot flip over violently. I am supposing this is due to the physics only simulating that small component of the model mentioned earlier.
*with the OGREmesh, the code above does soemthing funny. The main body of the robot (which was grouped together in the CAD program) is shown at the same size as the component mentioned in the COLLADA test. The wheels in the model (which were grouped separately) are shown at the value in "car.setLocalScale(10)." The body itself no longer responds to setLocalScale.
The debugShape is the size of the BODY of the model only (wheels not included) which is again, very small and not responding to SetLocalScale methods. The debugShape is also localed about 1 world-unit ABOVE the model itself.It is exactly the same size, shape and location of the debugShape as from the COLLADA test. I have a suspicion that the small OGRE mesh central model is due to some kind of OGRE loading error. Since the body of the model is actually the exact same size as the only component that loads in the Collada test. Literally I think the entire grouped "body" of the model is being loaded into the size of the PART of the model.
====Terrain====
-- I can load a TERRAIN model as a OGRE Mesh XML, and then use findGeom to make a physics node of it if I simply don't pass a name String to the method as such: final Geometry terrain = findGeom(TerrainNode, "");
Small success, YAY! However, when I do this, I loose the OGRE material involved and have to apply the image manually, which is not ideal. Also my Vehicle stand-in slides sideways down the sides of the terrain, even on a very slight angle. I suppose I'll have to play with wheel friction?