GhostControl collision and invisible wall

Hi,
I’m having a lot of fun with JMonkeyEngine, it’s really awesome! :slight_smile:

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?

If its a physical object that you cannot pass through its a rigidbody control. Check all the physic controls you have, if they are attached to one node you can do node.detachAllChildren(); But it looks like your not removing one of yours physics controls.

1 Like

Thanks! I’ve moved around my Geometry and in fact, the obstacle had nothing to do with it! :slight_smile: