Search Unity

Sampling the splatmap with raycasts

Discussion in 'Scripting' started by Dougxing, Feb 5, 2009.

  1. Dougxing

    Dougxing

    Joined:
    Mar 13, 2008
    Posts:
    90
    It seems like it should be possible to get a pixel from a terrain's splatmap corresponding to where a raycast hit in 3D, but I can't find a one-step way to do it and I don't see the tools to do it by hand either. TerrainData is the obvious place to look, but I only see ways to get at height data.
    In case it matters, let's assume that the splatmap and the hieghtmap are the same dimensions.

    Any ideas?
     
  2. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    Can't you just pull the pixel from the corresponding position in an array? Where you want to look, btw, is terrainData.AlphaMap