BoundingCollisionResults problem


I’m working in my first project with JME and I’m having some problemas with collision management.

I’m just trying to achieve that a message appears in the output prompt when a box (EnemigoEstaticoSuelo) and a sphere(Disparo) intersect.

I have tried to use “intersects()” and with BoundingCollisionResults, and it’s not working. I am a novice in game programming and I am stuck at that point.

This is part of my code:

[java]protected final void initGame() {

/** Create rootNode */

rootNode = new Node(“rootNode”);


  • Create a ZBuffer to display pixels closest to the camera above
  • farther ones.


    ZBufferState buf = display.getRenderer().createZBufferState();




    // ---- LIGHTS

    * Set up a basic, default light. /

    PointLight light = new PointLight();



    light.setLocation(new Vector3f(0, 1, 40));


    * Attach the light to a lightState and the lightState to rootNode. /

    lightState = display.getRenderer().createLightState();





    * Let derived classes initialize. */


  • Update geometric and rendering information for both the rootNode and
  • fpsNode.


    rootNode.updateGeometricState(0.01f, true);


    results = new BoundingCollisionResults() {

    public void processCollisions() {

    if (getNumber() > 0) {

    System.out.println("Enemigo Hit!: "+getNumber());





    [java]protected void simpleUpdate(float interpolation) {


    if(enemigoCreado == false){

    if (personaje.getWorldTranslation().getZ()>15){

    enemigoCreado = true;

    ees = new EnemigoEstaticoSuelo(“Enemigo”);





    //rootNode.updateGeometricState(interpolation, true);


    if (d!= null)

    d.calculateCollisions(ees.getEnemigo(), results);



    In the code, d is an object of the class Disparo, that extends Node and has a Sphere as attribute, ees is an object of the class EnemigoEstaticoSuelo, that extends Node and has a box as attibute.

    I have alse tried to call calculateCollisions with d.getBala(), that is the Sphere itself, but it’s not working either.

    Do you have any idea of how to solve this?

    Thank you!

I have been trying a lot of different methods to detect collisions and I have not achieved any proper result. Can anyone help me?

Thank you.

Taken from

...Assume you have two collidables a and b and want to detect collisions between them. The collision parties can be Geometries, Nodes with Geometries attached (including the rootNode), Planes, Quads, Lines, or Rays...

protected void simpleUpdate(float interpolation) {


if(enemigoCreado == false){
CollisionResults results = new CollisionResults();
if (d!= null)
d.getThatSphereOfYours_MustBeGeometry().collideWith(ees.getEnemigo().getThatBoxOfYours_MustBeGeometry, results);
Collisions? " + results.size() + "
for (int i = 0; i < results.size(); i++) {
// For each hit, we know distance, impact point, name of geometry.
float dist = results.getCollision(i).getDistance();
Vector3f pt = results.getCollision(i).getWorldContactPoint();
String hit = results.getCollision(i).getGeometry().getName();
System.out.println("* Collision #" + i);
System.out.println(" Collision with " + hit + " at " + pt + ", " + dist + " wu away.");

hope that helps