Hi community,
is there any way to use Texture2D.GetPixel and Physics.Raycast to get color where raycast hit?
The RaycastHit object that you can get out of the Physics.Raycast can give you the UV coordinates (0.0 to 1.0) of the point it hit. If you know the size of the texture, you can multiply the UV coordinate by the texture size, then round that down, to get back approximately which pixel it’s on. The example in the reference on RaycastHit.textureCoord does pretty much exactly what you want.
You can use getpixelbilinear with the UV cords.
Karl