Move spatial object does not work

Hi all!

I like to move a spatial object in a scene with the move method. I can see that local/world translation coordinates from the spatial change, but I can not see the movement on the screen.

Why is that? Can you help me?

Thanks for help.

Code?

Is it a physics object by any chance? You can no longer move spatials directly if they have rigid body controls.

private Node topViewNodeSMGB;
private ArrayList components = new ArrayList();

public void attachLocation() {
getViewPortObj().attachScene(topViewNodeSMGB);
JMECanvas.getApplication().enqueue(new Callable() {

              @Override
              public Spatial call() throws Exception {
                    final Node allComponents = JMECanvas.getApplication()
                               .getScene().getTransportComponentNode();
                    Box quadMesh = new Box(9.0f, 0.5f, 2.0f);
                    Geometry floorGeom = new Geometry("quad", quadMesh);
                    Material floorMat = new Material(JMECanvas.getApplication()
                               .getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
                    floorMat.setColor("Color", ColorRGBA.Red);
                    floorGeom.setMaterial(floorMat);
                    Vector3f pos = new Vector3f(0, 0, 0);
                    pos.y = -1f;
                    floorGeom.setLocalTranslation(pos);
                    attach(floorGeom);

                    // show only the materials in the materials list
                    for (int i = 0; i < materials.size(); i++) {
                         TransportObject obj = ObjectCache.getObjects().get(
                                     materials.get(i).getValueId());
                         Spatial comp = JMETransportComponentGenerator
                                     .getGenerator().create(obj);
                         materialsInScene.add(comp);
                         attach(comp);
                    }
                    topViewNodeSMGB.updateGeometricState();
                    return null;
              }
              protected void attach(Spatial comp) {
                    topViewNodeSMGB.attachChild(comp);
                    components.add(comp);
              }
        });
  }

And the spatial in the scene I would for example like to move with

Spatial comp = …
comp.move(-1f, 0f, 0f);

I can assure you 10000% that this will work fine normally. So something else is wrong.

Create a simple test case and you will see that it works fine. So the issue is in your code. I mean, we can’t even see where you are calling move() in the first place.

…and something weird is going on because you shouldn’t have to call:
topViewNodeSMGB.updateGeometricState();
…unless you are managing your own viewport and even still that’s not really the right place to do it.