@Override public void simpleUpdate(float tpf) { time += tpf; int random = rand.nextInt(2000); float mult1 = 1.0f; float mult2 = 1.0f; if (random < 500) { mult1 = 1.0f; mult2 = 1.0f; } else if (random < 1000) { mult1 = -1.0f; mult2 = 1.0f; } else if (random < 1500) { mult1 = 1.0f; mult2 = -1.0f; } else if (random <= 2000) { mult1 = -1.0f; mult2 = -1.0f; } box = batchNode.getChild("Box" + random); if (box != null) { Vector3f v = box.getLocalTranslation(); box.setLocalTranslation( v.x + FastMath.sin(time * mult1) * 20, v.y + (FastMath.sin(time * mult1) * FastMath.cos(time * mult1) * 20), v.z + FastMath.cos(time * mult2) * 20); } terrain.setLocalRotation(new Quaternion().fromAngleAxis(time, Vector3f.UNIT_Y)); }