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]