RaycastHit.point is the vector3 that represents the collision point in world space… you want to compare the x/y/z coordinates of the hit point with some values… …
edit: if you’re asking “how do I compare a vector3 against some values?”
// generic answer
if(myVector3.x < 10f) { ...
// bit more specific
if(hit.point.x < 10f) { ...
If I understood your problem correctly, something like this:
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
Physics.Raycast(ray, out hit);
if (hit.point.x>0.5f && hit.point.<3.5f && hit.point.y>0.0f && hit.point.y<3.0f)
{
// Do This...
}
if (hit.point.x>2.5f && hit.point.x<5.5f && hit.point.y>2.0f && hit.point.y<5.0f)
{
// Do That...
}
That’s not a very good idea - if the raycast doesn’t hit something, hit.point will be 0,0,0. You probably want to handle the case “The raycast hit nothing” differently from “the raycast hit something at near (0,0,0)”