Hi, I have a function that sends rays from camera. If the ray hits to an object function returns red and if not returns white. I want to get the color of a point if a ray hits an object and return it instead of red and return white if there is nothing there. How can i get the color?
function TracePixel (x : int, y : int) {
var ray : Ray = camera.ScreenPointToRay(Vector3(x * resolution,y * resolution,0));
if (Physics.Raycast(ray,rayDistance))
{
return Color.red;
}
else {
return Color.white;
}
}
var hit : RaycastHit; returns some information about the point but i could not reached the color of the point. Is it possible to get that color?