Esempio n. 1
0
    public GameObject createTerrain(USlippyTile tile, string key)
    {
        GameObject t = new GameObject(key);

        if (genTerrain)
        {
            /// crete the TerrainData
            TerrainData tData = new TerrainData();
            tData.size = new Vector3(chunkSize / 8, 0, chunkSize / 8); // don't know why 8, but terrain its 8 times bigger than this numbers

            /// add the terrain Collider and the Terrain based in the TerrainData
            TerrainCollider tColliderComp = t.AddComponent <TerrainCollider>();
            Terrain         tComp         = t.AddComponent <Terrain>();
            tColliderComp.terrainData = tData;
            tComp.terrainData         = tData;

            /// change the terrain material
            tComp.materialType = Terrain.MaterialType.BuiltInLegacySpecular;

            /// create and init the UTerrain that will load the height data
            UTerrain uTerrain = t.AddComponent <UTerrain>();
            uTerrain.init(tile, this);
        }

        if (genOSM)
        {
            /// create and init the UTerrain that will load the height data
            OSMChunk osmChunk = t.AddComponent <OSMChunk>();
            osmChunk.init(tile, this);
        }

        if (genOSM && debugOSM)
        {
            /// only for debug visualization
            OSMDebug visualization = t.AddComponent <OSMDebug>();
        }

        //t.AddComponent<AssignSplatMap>();

        return(t);
    }
Esempio n. 2
0
 void Start()
 {
     sNodes = new Vector3(nodeSize, nodeSize, nodeSize);
     chunk  = GetComponent <OSMChunk>();
     offset = new Vector3(0, 44000, 0);
 }