PhysicsTickListener not working with COLLISION_GROUP other than 1?

When I modify TestBrickWall such that the projectile does not colide with anything using COLLISION_GROUPs for example:
[java]
bulletNode.setCollisionGroup(PhysicsCollisionObject.COLLISION_GROUP_02);
bulletNode.setCollideWithGroups(PhysicsCollisionObject.COLLISION_GROUP_03);
[/java]
The prePhysicsTick() and physicsTick() in BombControl implementing PhysicsTickListener is never called :(. I tested that like this

[java]
public void prePhysicsTick(PhysicsSpace space, float f) {
System.out.println( " prePhysicsTick " );
space.removeCollisionListener(this);
//rayTest( );
}[/java]

I need this because I wan’t to make projectile affected by physical forces ( wind drag, gravity, initial aircraft velocity ) for aircraft simulator. I’m trying to use rayTest() according to recommandation from here
http://hub.jmonkeyengine.org/forum/topic/physics-help-bullet-through-paper-issue-solved/

my raytest looks like this

[java]

// test if there is and obstacle between this and the next physical tick
public void rayTest( ){
if ( (target!=null) ){
getPhysicsLocation(vector);
ray.setOrigin(vector);
this.getLinearVelocity(vector2);
float vlen = vector2.length();
vector2.normalizeLocal();
ray.setDirection(vector2);
float maxDist = vlen*dtray;
target.collideWith(ray, results);
if (results.size() > 0) {
target=null;
CollisionResult closest = results.getClosestCollision();
float dist = closest.getDistance();
if ( dist < maxDist ){
Vector3f loc = closest.getContactPoint();
System.out.println( " Hit “+dist+” “+loc );
collisionEffect(loc);
} else {
System.out.println( " Hit to far “+dist+” > “+maxDist );
}
} else {
System.out.println(” rayTest : no Results”);
}
}
};
[/java]

OK, again may fault, I just overlooked that BombControl adds TickListener to PhysicsSpace just affter collision event, not before.
So I soved that writing getPhysicsSpace().addTickListener(bulletNode); into TestBrickWall.onAction. Now it is working… such a shame :mrgreen:

Strange, that I always spend >1 hour trying to find an error… than I write a question to this forum, and in next 10-20 minuts I found the error by myself. So in some sense the forum the question helps :mrgreen:

2 Likes