Detecting if mouseclick is within path

Hey good people, i have a question for you which i hope that i’m able to explain.

I’m making a tower defence game in 3d. In the game you put out a rallyflag to place some soldiers. I’m detecting the mouseclicks by raycasting on a plane collider, which is working fine. One thing a cannot figure out though is how to check if that mouseclick is within the curvy path. My first thougth was to put colliders on the path, either roughly with cubes and box colliders or by making a 3d volume of the path in an external 3d program and then making a mesh collider for that volume.
The problem with the first idea is that i don’t know how to raycast on multiple combined colliders, is this even possible? And i’m afraid that the other idea would take to much performance power, it seems a bit overkill to make a mesh collider for this problem.

Check out the code below:
The objectsurface is the plane collider i’m raycasting on. You can also see the rallyDistance which is the maximum distance from the tower which the soldiers can be placed.

RaycastHit hit; 
Collider coll = objectSurface.GetComponent<Collider>();
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); 

if(coll.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition),out hit,100.0f)){
   Vector3 mouseP = hit.point;
   if(Vector3.Distance(mouseP, gameObject.transform.position) <= rallyDistance){
      objectRallypoint.transform.position = mouseP;	
   } else{
      Debug.Log("out of range");
   }
}

As i mentioned this code works fine expept it doesn’t check if the click is within a path. It seems like such a simple thing, but i can’t get my head around it. I hope any of you have some good ideas of how to get around this. Thanks in advance!

You need to add a lowpoly mesh and use that as a collider, Since you have a long path, you dont need to break the mesh in to different objects. Just use the external 3D application to build a lowpoly around the path and use that as a mesh collider. I dont think, it will be very expensive in memory, of course it will be quiet higher compared to box collider, but it should be alright in your case.