Get colour of terrain on raycast hit

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to get the (accurate) colour of a piece of terrain from a raycast result.

  2. What is the issue? Include screenshots / videos if possible!
    Raycast is returning the wrong colour for a piece of terrain from a raycast.
    It works on normal parts and meshes, and makes a part of the expected colour and material, but terrain parts on sand come back grey. (0.639216, 0.635294, 0.647059 color3)

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Tried rayResult.Color, rayResult.Instance.Color, all returns the wrong thing.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Is workspace.Terrain:GetMaterialColor(rayResult.Material) what you’re looking for?


And now I feel silly… thank you, yes that helps.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.