Collision Results and Colliding With it's own Parent

Hi there!

I’m trying to have items that collide into eachother and based on that will damage them.

My problem is detecting a collision between two objects in the same node!

I have a “collideNode” which has all my items (barrels tables etc…) and am attempting to use the worldBound() to tell whether two of thse objects are colliding.

Problem is, it’s constantly colliding with the node because the object itself is in that node!

So… how do I detect a collision with a node, that isn’t itself, while the object is in the node it’s attempting to collide with!

here is the current method

[java] CollisionResults results = new CollisionResults();
currentCrate.collideWith(collideNode, results);

if (results.size() > 1){
  Geometry collision = results.getCollision(0).getGeometry();
  Collidable hitCrate = (Collidable) collision.getParent().getParent();
  if (hitCrate.hitCool == 0) {
    System.out.println("A crate has hit another crate!" + results.size()); = - 1;
    hitCrate.hitCool = 1;

  if( <= 0)

I don’t know how it could be colliding with the node because normally collisions only happen on Geometry. You probably mean that you are colliding with your own geometry since you are using the bounding sphere.

…but anyway, I don’t see why the simple solution isn’t just:
if( hitCrate == currentCrate ) continue;

…you really should be looping over the results anyway. (you might be hitting 50 crates, for example)

Often the results list is over 1,000 collisions every tick and iterating over these results constantly just freezes up and is too much to handle.

And yes it is colliding with its own geometry.

currently the “currentCrate” is inside a for statement iterating over all the collidables within the node. Is there a way to take the one currentCrate I have, and check to see if that specific geometry is colliding with other geometries within it’s own node, and not itself.

Rather than iterating over a massive list of self colliisions.

1000 crates already sounds pretty crazy. What kind of game is it?

For collisions you probably want to divide your world up into a grid so that you only collide with what’s local… and then you only want to collide things that have moved, etc…



What I’m saying is that this thing is just sitting there, colliding with itself constantly, like the crate… is colliding with itself creating a huge list of collision results.

Even if I have a single crate there, it will constantly sit there and give me collision results.

It is also a bullet physics environment.

But it will only collide with itself once? How are you building up thousands of collisions?

Well I’d have no idea, but I did solve it by creating a second node, and attaching them to a second node for a short amount of time.

Not a great fix, but can be taken advantage of for combos in the future.