Ive seen this topic is super old. But couldnt find another way yet. I understand the reason behind avoiding "set position" when using the physics behavior due to lateUpdate and so. My situation is the following:
Im building an infinite top down game, camera following the player, player can move in all directions. To make it possible to generate new level parts and "forget" old ones, i created a 9 square grid. Whenever the player overlaps with the next tile e.g. up: step one - the bottom row of the level squares positions above the other and then step two - the whole grid is shifted to the original position.
player is on 5, entering square 2:
1 2 3
4 5 6
7 8 9
becomes:
7 8 9
1 2 3
4 5 6
and the whole grid shifts down by one row.
This way you can walk in every direction like on an escalator.
The problem appears now in the second step, when repositioning the grid / everything, the level, assets etc. I also need to reposition the player, that is controlled by physics force.
How can I get such an effect?
Its not possible to position "Layers", also having everything that needs to do the level shift in a "Family" doesnt do any good. Containers dont help. And setting the position of the player naturally sets his velocity to 0.
Any ideas or other approaches? I built a linear endless runner before. Theres tons of tutorials on that. Also on generating levels randomly "beforhand". But not live in all 4 directions.
Would love to hear from anybody. Any help is much appreciated.
Best,
Chris