but it not work when the character runs over an oblique object (like into the image below). I think that the problem are the others two character’s colliders because if I delete they the linecat detect when the character is on Ground layer.
How can I solve this problem ? I can’t delete the others two colliders…
No, I have used linecast and now I must change the logic of the game…but why linecast not work ? Unity prject https://www.assetstore.unity3d.com/en/#!/content/11228 use linecast and there are oblique object and work fine…
The linecast goes from the middle of the player to the middle of the contact object. Therefore if hits the collider of the contact object first before reaching the middle of the contact object. Since you are casting on a specific layer it should not hit the collider of the contact object - but it still does. So the only error I can imagine is, that your player/foot object is in the same layer as the ground. This must not be!