Islands of plenty

Now we can walk on islands, move between them and even explore what islands are out there. There isn’t lengthy fun to that however, seeing as our islands are bare and devoid of life. Let’s see if we can’t add some lovely trees and bushes to fix that problem. Let’s also try adding some wildlife to our islands.

I visited the Unity Asset Store and quickly found some nice looking environment. The environment asset package I’ll be using is made by A.C. It’s small but it’s free and it serves the purpose of populating the islands a little to make them more interesting. This pack comes essentially with 2 variations, Green vegetation or red/brown vegetation. I’ll be treating these as different biomes. I approached flora instantiation simply by randomly firing a bunch of rays downwards onto the ground within the scope of each island and then processing this information, figuring out if ┬áthe spot is safe to place vegetation or not e.g I don’t want to put tress or grass on sand or cliffs. But we already did checks like these when applying colors to the terrain so it’s easy peasy to just redo them here.

Already our islands feel much more vibrant and alive. Tweak your vegetation density all you want to create more or less barren environments to full and lush ones.

Now we have flora, now we need fauna. I went on the asset store again to aquire some free assets and I found a horse made by Dootsy Development with 3 animations. Idle, walk and run. Works perfect as an example when animation controller is tweaked and we add a NavMeshAgent to it. Now we need a navmesh that the fauna AI can walk upon. For each island I make a NavMeshData. I used the island mesh as a NavMeshBuildSource and got the default NavMeshBuildSettings through NavMesh.GetSettingsByIndex(0) for the NavMeshBuilder.BuildNavMeshData call and then added the created data to NavMesh.AddNavMeshData. Now I can raycast points across the island terrain and set those as the horses target destination and they will navigate to it if they can.