# Collisions not occurring as expected (troubleshooting ideas needed)

This is probably just something dumb I’m doing, but I just can’t see what I could be doing wrong here. I’m trying to collide a Ray with a large Spatial, take the collision point, and place objects there. For some reason the ray never collides with the (very large) mesh. Perhaps I’m mixing up how jME handles Y/Z axis or how collideWith() works, or who knows. Here’s the collision code:

[java]

Vector3f origin = new Vector3f(p.initialCoordinatesX, 100, p.initialCoordinatesY);

Vector3f direction = new Vector3f(0, -1, 0);

Ray ray = new Ray(origin, direction);

CollisionResults results = new CollisionResults();

landGeometry.collideWith(ray, results);

CollisionResult r = results.getClosestCollision();

float z = 5;

if (r != null) {

z = r.getContactPoint().z;

}

[/java]

The positional data I’m loading considers the Z plane up/down (this is why I have the Y and Z axis swapped) initialCoordinatesX and Y values are definitely within range of the geometry being collided with. All I need to do is fire a ray at some high elevation, store the collision “altitude”, and use that as the jME Y (vertical) component. But r always == null – so getClosestCollision() just returns null (so everything always ends up at the default height of 5). Are there any useful troubleshooting techniques I can use to figure out what’s going on here? (Arg, this should be easy!)

Er - funny stuff - JUST as I posted this I realized I’m taking the z (DEPTH!) element from the collision point, not the y.

Arrrrrrrrrggggggghhhhh!

Oh well, I guess the post still stands if anyone has any useful/special troubleshooting tips.