-
Notifications
You must be signed in to change notification settings - Fork 2
Terrain
mika edited this page Dec 25, 2017
·
3 revisions
- void CreateTerrain(string id, int size, float x = 0, float y = 0, float z = 0, int terrainMaxHeight = 300, int heightmapResolution = 512, int baseMapResolution = 512, int detailResolution = 512, int resolutionPerPath = 8)
- creates terrain object, with default grass texture
- size is world size in meters, default position is at 0,0,0 (pivot at the bottom left corner of the terrain)
- other parameters are optional (resolutions should be kept low <1024 on mobile)
- float GetTerrainWorldHeight(string id, float x, float z)
- Gets world Y position from terrain in given world x, z coordinate
- void DropObjectToTerrain(string target, string terrainid, float x, float z, bool align = true)
- Moves, drops and aligns object to terrain normal in world x, z position
- Optional param to align to surface normal
- void SetTerrainHeightmapFromPerlinNoise(string id, float noiseScale, float heightScale, float noiseOffsetX = 0, float noiseOffsetZ = 0)
- Sets terrainheightmap using perlinnoise
- try low noiseScale values, like 0.007
- heightscale is value between 0-1. 1 means full terrainMaxHeight
- void SetTerrainHeightmap(string id, string url, float heightScale = 1, bool invert = false)
- loads grayscale heightmap and assigns to terrain
- after loading and processing, WaitForMe bool is set to false void SetTerrainTextureFromLibrary(string id, string libraryTexture, int tileSizeX = 15, int tileSizeY = 15)
- assign texture from library to terrain
- optional texture tiling size
- Available library textures: "asphalt,bark_black_pine,base_wood,blue_plastic,ceramic,church_tiles,cobblestone,concrete_tiles,fabric_suit_vintage,flooring_board,forest_ground,grass,ground_beach,ground_moss,ground_mud,hexagon_path,macro_hull,marble,metalplate,metropolian_street,moss,paving_stone,sand1,sand2,stylised_brick,stylised_ice,stylised_rock,wood_planks"
- void SetTerrainTreemap(string id, string url, float treeThreshold, float treeDensity, float treeSize, bool resetTrees=true, bool invert = false)
- Paint trees to terrain, using splat texture (RGB colors are used for each tree)
- Note: First you must assign trees to terrain using [TODO]