SebLague / Procedural-Landmass-Generation

Procedural Landmass Generation in Unity
https://www.youtube.com/playlist?list=PLFt_AvWsXl0eBW2EiBtl_sxmDtSgZBxB3
MIT License
1.1k stars 596 forks source link

Pass in heightScale of the preview Mesh GameObject #11

Closed Xavator closed 7 years ago

Xavator commented 7 years ago

After Sebastian changes the TerrainChunks from a primitive to a regular GameObject, he stops setting the scale; meaning it goes from (10, 1, 10) to (1, 1, 1). This is correct, but causes the user to instinctively tone-down the heightMultiplier (from 125 to 25 in my case), but the scale of the Mesh GameObject is sitll (10, 1, 10). These changes will allow the scale of the preview GameObject to be adaptive and still be representative of what will be generated at runtime. Note: This all assumes that the plane is a square (x and z are the same), which is why only the localScale.x is used.

Xavator commented 7 years ago

I should mention that the preview GameObject is only going to show the first chunk, but that now it can be scaled. This is mainly so the changes made to the height multiplier are consistant no matter what the scale of the preview Map GameObject is.

While I'm on the subject, the material for the preview Map GameObject should have its tiling & offsets set to the following Tiling: X: -1 Y: 1 Offset: X: 1 Y: 0 This will make it so the flat map and the preview mesh are of the correct orientation. The tiling for the material used by the preview Mesh GameObject (Tiling: (1, 1) Offset (0, 0). Finally set the scale of the Mesh preview GameObject to 1, 1, 1. Make a GameObject to contain the preview Map GameObject (the flat one) and set its scale to (0.1, 1, 0.1) Re-generate the colormap and mesh. For some reason, I could not get the chunk to have the correct orientation with both the flat map and mesh preview.