Rebake Lightmap - for moveable objects

Hi there!

My Problem: I want to bake shadows of objects (e.g. trees) onto ground-tiles, and reuse (move) those tiles later. But the shadows stay at the initial baked positions.

Think of an endless runner, where you de-activate passed leveltiles, and add them to the track later on.

My Question: Is there a proper way to use the PlayCanvas built-in lightmaps for moving objects without setting the shadow Update Mode to “Realtime”? Because I don’t move them every frame, just every X seconds.

My suggestion would be to call

this.app.lightmapper.bake();
this.light.light.shadowUpdateMode = pc.SHADOWUPDATE_THISFRAME;

everytime I re-position a tile, and pass all the objects on the tile as an argument to the bake() function so I don’t have to rebake the whole scene.

Here is a small example scene: https://playcanvas.com/project/551103/overview/lightmaptest

Every second the the plane and cubes get repositioned, but the baked shadow isn’t updated.

Any hints highly appreciated!

Thanks in advance,
Rene