Is it possible and if it is what would be the best way to get Color from RaycastHit?
Example code:
Example code:
var layers = LayerMask.GetMask("Terrain", "Debris");
var ray = new Vector3(0, 200, 0);
RaycastHit hit;
if (Physics.Raycast(ray, Vector3.down, out hit, 200, layers )) {
//How to get Color from hit (RaycastHit)?
}
I've tried to extract it with hit.textureCoord and then applying it to material.mainTexture but textureCoord is always 0, 0 for me (empty value). Is there any way to do this?