hi there, first post here,
i have a problem with collisions.. i'm beginner with jme and not so skilled with java just yet..
i loaded a maze object (wavefront file.obj with file.mtl and textures)
it displays fine, and jme looks very interesting..
here's the inside of the object:

now about my collision problem,
as shown on below picture (when i move away from the object)

i can see a single giant bounding box surrounding the whole maze object.
i tryed collision with it and it worked, but,
what i'm trying to do is to have collision test with walls and floor, ceilling..
why when i'm inside the maze and i don't touch walls or floor or ceilling the collision still happen?
only when i get out of the maze and its giant bounding box the collision stops..
what do i am missing ?
thanks for your attention
and here's the code:
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.CollisionTree;
import com.jme.bounding.CollisionTreeManager;
import com.jme.intersection.CollisionData;
import com.jme.intersection.CollisionResults;
import com.jme.intersection.TriangleCollisionResults;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Geometry;
import com.jme.scene.Spatial;
import com.jme.scene.shape.Box;
import com.jme.util.export.binary.BinaryImporter;
import com.jmex.model.converters.FormatConverter;
import com.jmex.model.converters.ObjToJme;
public class HelloModelLoading extends SimpleGame {
Spatial b, m;
CollisionResults results;
CollisionData oldData;
public static void main(String[] args) {
HelloModelLoading app = new HelloModelLoading();
app.setConfigShowMode(ConfigShowMode.AlwaysShow);
Logger.getLogger("").setLevel(Level.SEVERE);
//MouseInput.get().setCursorVisible(true);
app.start();
}
protected void simpleInitGame() {
CollisionTreeManager.getInstance().setTreeType(CollisionTree.Type.AABB);
results = new TriangleCollisionResults();
b = new Box("box", new Vector3f(0,0,0), 1, 1 ,1);
b.setLocalScale(.1f);
((Geometry) b).setSolidColor(ColorRGBA.white.clone());
b.setModelBound(new BoundingBox());
b.updateModelBound();
URL model=HelloModelLoading.class.getClassLoader().getResource("data/test_01_02.obj");
FormatConverter converter=new ObjToJme();
converter.setProperty("mtllib",model);
ByteArrayOutputStream BO=new ByteArrayOutputStream();
try {
converter.convert(model.openStream(), BO);
m=(Spatial) BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
m.setLocalScale(.1f);
m.setModelBound(new BoundingBox());
m.updateModelBound();
rootNode.attachChild(b);
rootNode.attachChild(m);
} catch (Exception e) { // Just in case anything happens
System.out.println("Damn exceptions! O_o n" + e);
e.printStackTrace();
System.exit(0);
}
}
protected void simpleUpdate() {
results.clear();
b.setLocalTranslation(new Vector3f(cam.getLocation()));
b.findCollisions(m, results);
if (results.getNumber() > 0) {
System.out.println("somehow collision happened n");
}
}
}