How to get biome at current player position?

Modified on Mon, 25 Jul 2022 at 10:29 AM

Use the GetBiome method to get the biome at any given position or based on altitude / moisture levels:


public BiomeDefinition GetBiome (float altitude, float moisture);

public BiomeDefinition GetBiome(Vector3d position);



Additionally, the method GetTerrainInfo can be used to get information about terrain at any position:


public HeightMapInfo GetTerrainInfo (Vector3 position);


This method returns a HeightMapInfo struct with the data associated to the position:


    public struct HeightMapInfo {
        public float moisture;
        public int groundLevel;
        public BiomeDefinition biome;
    }


- moisture: a value in the 0..1 range.

- groundLevel: an integer value that represents the altitude of the terrain in world space.

- biome: the biome found at that position.


Example code:


VoxelPlayEnvironment env = VoxelPlayEnvironment.instance;
Vector3 playerPosition = VoxelPlayPlayer.instance.GetTransform().position;
HeightMapInfo terrainInfo = env.GetTerrainInfo (playerPosition);
Debug.Log ("Current biome is " + terrainInfo.biome.name);




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article