Search Unity

Paint texture inside arbitrary polygon on terrain. How to?

Discussion in 'Scripting' started by Efril, Jan 11, 2014.

  1. Efril

    Efril

    Joined:
    Aug 31, 2013
    Posts:
    82
    Hi all. I wonder how can I paint a texture inside an arbitrary polygon on terrain surface? The closest analogue is brush of standart unity terrain editor. But I want brush which completely dynamic (size and form) and accesible from custom editor script. I understand that I can set texture in terrain data alphamap at appropriate alphamap coordinates. But how can I know which alphamap coordinates (x,y pair) are inside my custom polygon? Or, probably, Unity have something built-in for such tasks?