stateManager.attach(bulletAppState);
// bulletAppState.getPhysicsSpace().setAccuracy(1f/30f);
bulletAppState.getPhysicsSpace().enableDebug(assetManager);
// Load Island
Node island = (Node) assetManager.loadModel("Models/Islands/ogre/island_01.j3o");
rootNode.attachChild(island);
// Load Island CollisionMesh
Node islandCollision = (Node) assetManager.loadModel("Models/Islands/ogre/island_01_collision.j3o");
Geometry geoCollision = (Geometry) islandCollision.getChild(0);
CollisionShape colShape = new MeshCollisionShape(geoCollision.getMesh());
colShape.setMargin(0.005f);
RigidBodyControl rigControl = new RigidBodyControl(colShape, 0);
island.addControl(rigControl);
bulletAppState.getPhysicsSpace().add(rigControl);
// Load trees
Node trees = (Node) assetManager.loadModel("Models/Islands/ogre/trees_01.j3o");
rootNode.attachChild(trees);
for (Spatial sp : trees.getChildren()) {
Node nd = (Node) sp;
nd.detachAllChildren();
if (nd.getName().indexOf("plant_01") == 0) {
// Load Tree
Node tree_1 = (Node) assetManager.loadModel("Models/Plants/ogre/plant_01.j3o");
tree_1.getChild(1).setQueueBucket(Bucket.Transparent);
nd.attachChild(tree_1);
}
else if (nd.getName().indexOf("plant_02") == 0) {
// Load Tree
Node tree_1 = (Node) assetManager.loadModel("Models/Plants/ogre/plant_02.j3o");
tree_1.getChild(1).setQueueBucket(Bucket.Transparent);
nd.attachChild(tree_1);
}
else if (nd.getName().indexOf("plant_03") == 0) {
// Load Tree
Node tree_1 = (Node) assetManager.loadModel("Models/Plants/ogre/plant_03.j3o");
tree_1.getChild(1).setQueueBucket(Bucket.Transparent);
nd.attachChild(tree_1);
}
else if (nd.getName().indexOf("plant_04") == 0) {
// Load Tree
Node tree_1 = (Node) assetManager.loadModel("Models/Plants/ogre/plant_04.j3o");
tree_1.getChild(1).setQueueBucket(Bucket.Transparent);
nd.attachChild(tree_1);
}
}
DirectionalLight dl = new DirectionalLight();