Bizarre Collision Behaviour with (Mesh) collideWith (BoundingVolume)

Getting really odd results with collideWith.

Here you can see two meshes. One is loaded from a mesh.xml file (textured with baked lighting) and the other is created from com.jme3.scene.shape.Box (white).

Here is a link to the mesh file:

When I perform model.collideWith(box.getModelBound), I get no collisions, which is what I would expect.

Here is another image that shows the box rendered as points. It is clear that it doesn’t intersect the mesh.

However when I increase the height of the box (towards the camera and away from the mesh) from 3 to 12, the number of collisions reported is 1???

I’m so confused.

Here is another image showing the points of the triangle that it is supposedly intersecting.

Any suggestions to what is going on here?

Different angle:


What version of jme are you using?

The latest nightly, jME3_2012-10-26.

getModelBound() returns the bound in model space. Collision calculation happens in world space, so you should be using getWorldBound().

Still get the same behaviour with getWorldBound ( thanks for pointing that out anyway).

The box min and max values are Vector3f(44, 0, -31.5) and Vector3f(45.5, 12, -29) respectively if you want to try and replicate the results.

Vector3f(44, 0, -31.5) and Vector3f(45.5, 3, -29) values return 0 collisions for me.

Are you changing the mesh by any chance? Perhaps you can post a test case?

No, I’m not changing the mesh.

Here is a test case, but it doesn’t use default assets exclusively. Requires level_test.mesh.xml which you can download here.

[java]package jme3collision;


import com.jme3.material.Material;

import com.jme3.math.Vector3f;

import com.jme3.scene.Geometry;

import com.jme3.scene.Spatial;

import com.jme3.scene.shape.Box;

import com.jme3.math.ColorRGBA;

import com.jme3.light.DirectionalLight;

import com.jme3.collision.CollisionResults;

public class JME3Collision extends SimpleApplication


public static void main(String[] args)


JME3Collision app = new JME3Collision();

app.start(); // start the game



public void simpleInitApp()


// Lighting

DirectionalLight light = new DirectionalLight();


light.setDirection(new Vector3f(-.1f,-.5f,-.1f).normalizeLocal());


// Geometry

Box shortBox = new Box(

new Vector3f(44,0,-31.5f),

new Vector3f(45.5f,3,-29));

Box tallBox = new Box(

new Vector3f(44,0,-31.5f),

new Vector3f(45.5f,12,-29));

Material mat = new Material(



Spatial level = assetManager.loadModel(“level_test.mesh.xml”);


Geometry shortBoxGeom = new Geometry(“shortBox”, shortBox);


Geometry tallBoxGeom = new Geometry(“tallBox”, tallBox);


// Collisions

CollisionResults results = new CollisionResults();

level.collideWith(shortBoxGeom.getWorldBound(), results);

System.out.println("Number of shortBox collisions = " + results.size()); // 0


level.collideWith(tallBoxGeom.getWorldBound(), results);

System.out.println("Number of tallBox collisions = " + results.size()); // 1



cam.setLocation(new Vector3f(45.5f,15,-29));




Has anyone managed to replicate the bug yet?