Rigidbody invisible?

Hello,
I am having an issue where if I build identical objects and give them a rigidbody, then only the first one added is visible. I have built a test case to show.
[java]
import com.jme3.app.SimpleApplication;
import com.jme3.bullet.BulletAppState;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.light.AmbientLight;
import com.jme3.light.DirectionalLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.shape.Box;
import com.jme3.system.AppSettings;
import java.awt.DisplayMode;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;

/**
*

  • @author root
    */
    public class Test extends SimpleApplication {
    public Material deMat;
    public BulletAppState phy;
    public Test() {
    AppSettings as = new AppSettings(false);
    as.setUseInput(true);
    as.setVSync(true);
    as.setTitle(“Phy Test”);
    as.setFrameRate(128);
    as.setRenderer(AppSettings.LWJGL_OPENGL1);
    as.setAudioRenderer(AppSettings.LWJGL_OPENAL);
    GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    DisplayMode mode = device.getDisplayMode();
    as.setBitsPerPixel(mode.getBitDepth());

     setSettings(as);
     setShowSettings(false);
     start();
    

    }

    public synchronized Node buildGround0() {
    Box b = new Box(2.75f, 0.5f, 2.75f);
    Geometry groundC = new Geometry(“ground0”, b);
    Material m = deMat.clone();
    m.setColor(“Color”, ColorRGBA.Blue);
    groundC.setMaterial(m);
    Node ground0 = new Node();
    ground0.attachChild(groundC);
    return ground0;
    }

    @Override
    public void simpleInitApp() {
    //Build View Port
    viewPort.setBackgroundColor(new ColorRGBA(.0f, .0f, 0.4f, 1f));
    //Build Lighting
    AmbientLight ambient = new AmbientLight();
    ambient.setColor(new ColorRGBA(.1f, .1f, .5f, 0.5f));//Light Blue
    rootNode.addLight(ambient);
    DirectionalLight sun = new DirectionalLight();
    sun.setDirection((new Vector3f(-0.5f, -0.5f, -0.5f)).normalizeLocal());
    sun.setColor(ColorRGBA.White);
    rootNode.addLight(sun);
    //Load Master material
    deMat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
    //Build Phy Space
    phy = new BulletAppState();
    stateManager.attach(phy);
    //Build cells
    int x = 0;
    while (x < 5) {
    Node cell = new Node();
    Spatial s = buildGround0();
    RigidBodyControl rbc = new RigidBodyControl(0.0f);
    s.addControl(rbc);
    cell.attachChild(s);
    rootNode.attachChild(cell);
    cell.setLocalTranslation(getCellLocation(x, 0));
    phy.getPhysicsSpace().addAll(cell);
    x++;
    }
    }

    public Vector3f getCellLocation(int x, int y) {
    float nx = x * 5;
    float nz = y * 5;
    System.out.println(“Building Vector3f for cell (” + x + ", " + y + " at " + nx + ", 0.0, " + nz + “)”);
    return new Vector3f(nx, 0.0f, nz);
    }

    public static void main(String[] args) {
    new Test();
    }
    }[/java]

1/ you should build a test case with only unshaded geometries, to make sure that they are not here (to remove the "you don’t see them cause a bug in the light setup)
2/ currently they are all at (0, 0, 0). Your call to “setLocalTranslation” does nothing, cause they have a physics control (here a rigidbodycontrol) that already set (=define) their position every frame. you should replace the “setLocalTranslation” (this one) by something like “rbc.setPhysicsLocation”.
3/ i didn’t test, maybe the bug comes from somewhere else.

Thank you for the reply.

@bubuche said: 1/ you should build a test case with only unshaded geometries, to make sure that they are not here (to remove the "you don't see them cause a bug in the light setup) 2/ currently they are all at (0, 0, 0). Your call to "setLocalTranslation" does nothing, cause they have a physics control (here a rigidbodycontrol) that already set (=define) their position every frame. you should replace the "setLocalTranslation" (this one) by something like "rbc.setPhysicsLocation". 3/ i didn't test, maybe the bug comes from somewhere else.

Point 1. I am using an unshaded material… Or is that not what you are referencing?

Point 2. I discovered this earlier which brings out a diffrent problem. If I have multiple rigidbody controls in each cell, how would I move them all at once? How could I use the parent cell node to move its children around when they have rigidbody controls?

You could just make yourself a list of all physicobjects you want to move?