Lag of moved Spatials

Hi all,



first of all: please forgive me my bad english! :slight_smile:



Im new to jME and just trying out some things. So today, i have programmed a little game with third person view like shown in Walking Character but:

in my game, the Golem is extremly lagging, whereas the tutorial doesn’t lag on my computer.



so i thought the reason is my game, but after hours off debbuging i didn’t found anything!



so i copied the code from Hello Collision and just add

[java]

Box b = new Box(Vector3f.ZERO, 1, 1, 1);

Geometry model = new Geometry(“Box”, b);

Material mat = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);

mat.setColor(“m_Color”, ColorRGBA.Blue);

model.setMaterial(mat);

model.setLocalScale(0.5f);

model.setLocalTranslation(0, 3, -7);

player.attachChild(model);

[/java]

to have a moving Spatial.



and what did it do? LAGGING ON MOVING



please tell me, what’s the trick in Walking Character, i didn’t found it after hours

(its not the Animation, i disabled it while searching)

ok, solved:



i didn’t knew that correct world positions are only available after updateGeometricState(), so i didn’t care about!



now i call updateGeometricState() twice:

  • after Player has moved
  • AND after camera has moved

    and it works perfectly





    so in conclusion: sorry for waste posting :wink:

I hope you dont call updateGeometricState on the single spatial, always use rootNode.updateGeometricState()!