Issue reusing CollisionShapes

I can’t really remember if i saw something about the topic posted in the forums though a quick search yields nill. For some odd reason for maybe the past year or so, I have been having problems switching out and reusing pre-calculated CollisionShapes.

Current example when I perform certain actions the characters mesh deforms in a predetermined way and a pre-initialized CollisionShape is set for the rigidBody; however, switching back and forth seems to cause some sort of issue and infact after the initial switch the physics debugger and collision tests show that the form doesn’t change back to the previous one.

The work around has simply been to recreate the shape before each use, and I vaguely remember the updated version of CharacterControl using this method versus simply created two Collisionshapes and switching between the two. Can anyone give me any insight into this occurrence?

Can you give us a small TestCase? As I’m not complety shure what you mean.

position the camera at a nice angle and repeatedly tap space or enter…Spacebar reuses pre-initialized shapes and enter creates a new shape each time…i’ve also found another odd issue if you go to the method onAction and go the mapping for switch i commented out a line, uncomment it and comment the one directly below it for another odd occurrence. There were a few other issues a vaguely remember; however, I always assumed it was my error and instead worked around it.

public class CollisionShapeBug extends AbstractAppState implements ActionListener {

    public RigidBodyControl rbc;
    public CollisionShape shape1;
    public CollisionShape shape2;
    public boolean switchShape;
    public Camera cam;

    public void initialize(AppStateManager stateManager, Application app) {
        super.initialize(stateManager, app);
        SimpleApplication sApp = (SimpleApplication) app;
        InputManager input = app.getInputManager();
        AssetManager assetManager = sApp.getAssetManager();
        Node rootNode = sApp.getRootNode();
        BulletAppState bullet = new BulletAppState();
        PhysicsSpace space = bullet.getPhysicsSpace();

        shape1 = new BoxCollisionShape(new Vector3f(1.0f, 1.0f, 1.0f));
        shape2 = new BoxCollisionShape(new Vector3f(0.5f, 0.5f, 0.5f));

        Box box = new Box(Vector3f.ZERO, 1f, 1f, 1f);
        Geometry cube = new Geometry("Bleed-through color cube", box);
        Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        material.setColor("Color", ColorRGBA.Green);
        rbc = new RigidBodyControl(shape1);//let it drop so can easier show change

        Box floorBox = new Box(20, 0.25f, 20);
        Geometry floorGeometry = new Geometry("Floor", floorBox);
        Material material2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        material2.setColor("Color", ColorRGBA.Pink);
        floorGeometry.setLocalTranslation(0, -0.25f, 0);

        floorGeometry.addControl(new RigidBodyControl(0));



        cam = app.getCamera();

                new KeyTrigger(KeyInput.KEY_SPACE));
                new KeyTrigger(KeyInput.KEY_RETURN));
        input.addListener(this, "BUGGED_SWITCH", "Switch");
        switchShape = false;

    public void onAction(String name, boolean isPressed, float tpf) {
        if (isPressed == true) {
            CollisionShape cs = null;
            if (name.equals("BUGGED_SWITCH")) {
                cs = switchShape ? shape1 : shape2;
            } else if (name.equals("Switch")) {
                float f = switchShape ? 1.0f : 0.5f;
                //uncomment below and comment the line after
                //cs = new BoxCollisionShape(new Vector3f(f, f, f));
                cs = new BoxCollisionShape(new Vector3f(1, f, 1));
            switchShape = !switchShape;

    public void update(float tpf) {
        cam.lookAt(rbc.getPhysicsLocation(), Vector3f.UNIT_Y);

    public static void main(String[] args) {
        Application app = new SimpleApplication(
                new FlyCamAppState(),
                new CollisionShapeBug()) {
            public void simpleInitApp() {
                 * A white ambient light source.
                AmbientLight ambient = new AmbientLight();
        AppSettings settings = new AppSettings(true);
        settings.putBoolean("DebugMode", true);

Is this an issue or were collisionshapes simply not meant to be reused?