Dynamic 2D Terrain Generation in Unity
Video showing one way to tame PhysX while creating dynamic, 2d, pixel perfect endless terrains as seen in hit games like Tiny Wings and Ski Safari. The main gist of the system we used was a three class approach: TerrainManager: Monobehaviour responsible for requesting new terrain to be created as the camera reaches the threshold of the current terrain. It manages 2 GameObjects each of which contains a dynamic terrain. When a new terrain is needed the old one (that is now offscreen) is reused and displayed to the right of the current terrain Terrain: responsible for creating the actual visible mesh and collision mesh. It uses data generated on the fly by the TerrainGenerator class TerrainGenerator: stores the terrain generation algorithm (which can be modified with subclasses or on the fly via properties). Allows access via the brackets operator (generator[index]) which creates data on the fly when an out of range index is requested. This allows the Terrain to request data at will when needed without having to worry about if it is available or not. For our full assortment of iOS, Android and Mac native code plugins checkout http://prime31.com/unity Be sure to subscribe to our channel to get updates as new videos go live!
Download
0 formatsNo download links available.