Collision with PhysicNodes

Hy guys!

Again me, again a problem for which I'm too dumb to solve it:D

I have a StaticPhysicsNode having walls in it. I created a CollisionGroup and associated my wall-Node to this CollisionGroup.

Now I have a DynamicPhysicsNode, which also has an own CollisionGroup.

I enabled collision by using

cgWalls.collidesWith(cgTank, true);

Ok, this works without problem, my tank collides with the wall.

But how can I check explicitly, that they collided?
I tried with

tankNode.hasCollision(wallNode, false)

But it doesn't signalize a collision...Any Ideas how this can be checked with a positive result?

I'm certainly too dumb for this type of programming....Oo

Kind Regards and please help me!

You need to use a contact callback. It will give you both objects involved in the collision.

Ok, does this mean, that I mean the SyntheticButton stuff?

Here is a snip from the test:

ContactCallback myCallBack = new ContactCallback() {
            public boolean adjustContact( PendingContact c ) {
                if ( ( magicBalls.contains( c.getNode1() ) && c.getNode2() == wall ) ||
                        ( magicBalls.contains( c.getNode2() ) && c.getNode1() == wall ) ) {
                    // Collision MagicBall <--> Wall
                    c.setIgnored( true );
                    return true;
                // everything normal, continue with next callback
                return false;
        // add our custom callback to the end of the List,
        // that way, our callback gets executed first
        getPhysicsSpace().getContactCallbacks().add( myCallBack );

And the test is here: Hope that gets you going.

Many thanks! That solved my problem in an elegant way…;D