Applying RigidBodyControl to a number of the same Spatial

Hey guys, I’m having trouble applying RigidBodyControl to a number of the same spatial(in this case multiple gold coins). All these coins have the same mesh and material. I can walk through these coins, they should have a rigidbodycontrol but they don’t. Here is my code:

[java]
public void dropRandomItem(AssetManager assetManager, Vector3f location, int amount) {
/**
* Gold coins that drop on the ground.
*/
gold = assetManager.loadModel(“Models/Items/Gold/Cylinder.mesh.j3o”);
gold.setMaterial(assetManager.loadMaterial(“Models/Items/Gold/gold.j3m”));

    goldCoins = new Node();
    amountOfGold = new Spatial[50];

    CollisionShape goldShape =
            CollisionShapeFactory.createMeshShape((Node) goldCoins);
    goldPhysics = new RigidBodyControl(goldShape, 2f);
    for (int i = 0; i < amount; i++) {

        amountOfGold[i] = gold.clone();
        amountOfGold[i].setMaterial(assetManager.loadMaterial("Models/Items/Gold/gold.j3m"));
        amountOfGold[i].addControl(goldPhysics);
        amountOfGold[i].setLocalTranslation(location.add(new Vector3f(random.nextInt(5) - random.nextInt(7), random.nextInt(6), random.nextInt(3))));
        amountOfGold[i].setLocalScale(0.5f, 0.5f, 0.5f);

        goldCoins.attachChild(amountOfGold[i]);
        
        game.getApp().getRootNode().attachChild(goldCoins.clone());
        game.getBulletAppState().getPhysicsSpace().add(goldPhysics);

    }


    //
}//end of dropRandomItem

[/java]

A control in general can only be applied to a single spatial. What you can do however, is share the collision mesh between different rigid bodies

@wezrule said: A control in general can only be applied to a single spatial. What you can do however, is share the collision mesh between different rigid bodies
A little snippet of code would be nice :D

Create a collisionShape for a coin, your goldShape doesn’t actually contain anything. Then inside the loop assign it goldShape

Got it, programming at 1am really decreases your skill. Thanks Wesley.