I need to know which texture I have on an area of terrain where an item is located.
I am trying to adjust movement depending on ground surface.
Any other suggestion would be welcome.
You might find the answer from @Duck in the following thread helpful: Terrain with multiple splat textures - how can I detect which kind is under my character's location? - Unity Answers
You can shoot a rayhit from each object down and by hit pixel get texture what exactly it is hitting.
Given a terrain (1), you can access the terrain data from it (2, 3) which holds information about the terrain such as the blending (4) of the splat prototype textures (5, 6) which make up the base textures of the terrain. I haven’t done this myself, just looked up the docs but it seems pretty straight forward given that the alpha maps are used to determine how much of a splat is being used.
- Terrain
- Terrain.terrainData
- TerrainData
- TerrainData.GetAlphamaps
- TerrainData.splatPrototypes
- SplatPrototype
Thanks guys