jME2 collision detection issues

Hi, I’ve got an issue with bounding collisions in jME2. I’ve got a class WorldObject which extends Node and I attach spatials/nodes relevant to each ‘World Object’ to its instance. The issue I’m having is that the character node (bound by a BoundingCapsule) is not colliding with an obstacle (bound by a BoundingBox), despite it happily colliding with other character nodes bound by BoundingCapsules.



I am at a complete loss here and cannot figure out why it is not colliding when it clearly should.



I’m using a special findCollisions within WorldObject that goes as such:

[java]public void findCollisions(WorldObject wo, WorldCollisionResults wc, int behavior)

{

if (getWorldBound() != null && isCollidable(behavior)

&& wo.isCollidable(behavior)) {

if (wo instanceof BoxObstacle | this instanceof BoxObstacle) System.out.println(“No collision in WorldObject”);

if (getWorldBound().intersects(wo.getWorldBound())) {

if (wo instanceof BoxObstacle | this instanceof BoxObstacle) System.out.println(“Collision in WorldObject”);

// further checking needed.

wc.setPair(this,wo);

for (int i = 0; i < getQuantity(); i++) {

getChild(i).findCollisions(wo, wc, behavior);

}

} else

{

if (wo instanceof BoxObstacle)

{

BoundingBox bb = (BoundingBox) wo.getWorldBound();

BoundingCapsule bc = (BoundingCapsule) model.getWorldBound();

System.out.println(bb.getExtent(null) + " at " + bb.getCenter() + ", " +

bc.getLineSegment().getOrigin() + " with " + bc.getRadius() +

" and yet collision?: " + wo.getWorldBound().intersects(model.getWorldBound()));

}

}

}

}[/java]

BoxObstacle is the extension of WorldObject for the obstacle. I’ve been attempting to find if there’s something subtle about getWorldBound() that I’m missing (thus the System-println here).

No collision in WorldObject
(110.0, 5.0, 110.0) at (90.0, 165.0, 90.0), (110.15385, 161.13002, 125.34238) with 17.58973 and yet collision?: false
Yet, by my sparse knowledge of bounding and such, this suggests that the result should be true as I know it should be.

Thanks for rummaging through my ramblings and I hope you can help.

Sorry, it appears I jumped the gun. I found the issue…:



The intersect() eventually calls this:

[java]



@Override

public boolean intersectsBoundingBox(BoundingBox bb) {

if (!Vector3f.isValidVector(center) || !Vector3f.isValidVector(bb.center)) return false;



// TODO Auto-generated method stub

return false;

}[/java]

Which is always false… is there a reason for that?

Well, I switched to using BoundingBoxes and the issue is fixed. Was not aware BoundingCapsule was so tough to collide with.



Sorry to jump the gun and see you around.