Physics.Linecast working only "part time"!

I have this function:

function noObstacles(checkpoint : GameObject){
var hitvalue : RaycastHit;
Physics.Linecast(transform.position,checkpoint.transform.position,hitvalue);
if (hitvalue.collider!=null && hitvalue.collider.gameObject.tag=="Jumpable") return false;
else return true;}

That I use to simply verify that a AI-controlled character can “see” a checkpoint, which I use to guide it around the level. My problem is that this only seems to work more or less 80% of the time. Some other times it doesn’t work: I tried to check with Debug.DrawLine and saw that the Linecast just passes through the platforms even if they’re tagged as Jumpable, for no apparent reason…

Can it happen if there is some other object hit by the Linecast (including the character and the checkpoint)? If that’s the case how can I avoid the problem? Any other solution?

Thanks in advance!

Hello!

I also have the same problem with a Linecast in my code (the linecast sometimes just ignores any collider it should meet) and I was wondering if you solved it.

I would be very happy if you shared the solution if you managed to solve it.

Thanks in advance!