Node.hasCollision() always false?

Hello everybody,

Perhaps i don’t understand something, but i’m trying to use the new method hasCollision() on a Node (and it seems very straightforward) but it seems to return always false ?

Furthermore when i look at the code, i think it return always false too :slight_smile:



1 Like

mixed intersections are not implemented. That means if you try to collide a node that has a BoundingSphere with a Node that has a BoundingBox, false will be returned. Make sure everything is using the same bounding volume types. The mixed intersections are on the todo list, just not sure when they will be attempted (at least it’s a fill in the blank problem).

Well i knew that, so i use only boundingBox,

in fact when i use :

if (myNode.getWorldBound().intersects(anotherNode.getWorldBound()))

it return true.

but when i use :

if (myNode.hasCollision(anotherNode, true))

it return false

i don't see what i'm making wrong :(



is checking intersection of bounding volumes:

myNode.hasCollision(anotherNode, true)

is checking intersection of trimesh (triangle accuracy).

You can either use

myNode.hasCollision(anotherNode, false)

which will only test for bounding volume collisions.

or check to insure you have set up the OBBTree using updateCollisionTree.
1 Like

Thanks mojo for your all your answers and your patience :slight_smile:

Alas myNode.hasCollision(anotherNode, false); doesn’t work either…

but when i look at the code of hasCollision() :

 public boolean hasCollision(Spatial scene, boolean checkTriangles) {
        if (getWorldBound().intersects(scene.getWorldBound())) {
            //further checking needed.
            for (int i = 0; i < getQuantity(); i++) {
                if (getChild(i).hasCollision(scene, checkTriangles)) { return false; }

        return false;

i don't see when it can return true...

bye and thanks again,


ok, update from CVS. Stupid typo. Sorry about that. ://

Works very well now, thanks mojo ! :slight_smile: