Hi,
I’m having a lot of fun with JMonkeyEngine, it’s really awesome!
I have a question: I have a projectile Geometry that should hit another Geometry with GhostControl. I want that on collision both to disappear. Here is my code of the Control:
[java]
protected void controlUpdate(float tpf) {
if(spatial != null) {
spatial.move(facing);
for (PhysicsCollisionObject obj:ghost.getOverlappingObjects()){
if (obj instanceof GhostControl){
System.out.println("Hit "+obj.getUserObject());
shootables.detachChild((Geometry)obj.getUserObject());
spatial.removeFromParent();
ghost.getPhysicsSpace().remove(obj);
ghost.getPhysicsSpace().remove(ghost);
}
}
}
}
[/java]
This (mostly) work, but after disappearing, the box leaves an invisible physical obstacle to my first-person camera walking character. Why is this? Am I doint this correctly?