marian42/wavefunctioncollapse

Not work when 'Map' is not on position 0,0,0?

Klanly opened this issue · 3 comments

Hi, great work.
But in 'Game.unity', when I move root gameobject 'Map' to position 600,60,600, and root gameobject 'Player' to 600,72,600. it seems stop generating.
Where should I modify the codes to make this work in a custom start-point (other than 0,0,0)?
Thanks a lot.

*by 'start-point', I mean the 'Map' GameObject coord in the scene, NOT about the start point of player in generated blocks.

It should work if you set the map to (0, 0, 0) and only move the player.

The code in question is in GetMapPosition and GetWorldspacePosition in MapBehaviour, although it should work without chaning anything.

It should work if you set the map to (0, 0, 0) and only move the player.

The code in question is in GetMapPosition and GetWorldspacePosition in MapBehaviour, although it should work without chaning anything.

What I need is a custom coord for 'Map' object tho...
I tried making a parent to contain these two and modified .position to .localPosition in MapBehaviour.cs but still no luck.
https://i.imgur.com/YyhfepU.jpg

In the default setup, the map has a "Generate Map Near Player" behaviour. You can give it a target transform and it it will generate the map around the area where the target transform is (by default that's the player). But this only works if the Map transform is at (0, 0, 0). You can remove the GenerateMapNearPlayer behaviour. Then, nothing will generate at all and you can move the map where you want and write your own script that calls
Collapse(Vector3Int start, Vector3Int size, bool showProgress = false).
You can do that by calling mapBehaviour.Map.Collapse(.... The start and size paramters are numbers of blocks relative to the position of the Map transform. If you do that, I recommend you also remove the Culling related behaviours.