Sometimes check the ground with a navigation
Now the method is not a good method
Hope the unity new API Direct and accurate to do this
//===========================================
public static bool NavMeshRaycast(Ray ray, float distance, float radius, out Vector3 hitPoint)
{
int samples = Mathf.RoundToInt(distance / (radius * 1.5f));
for (int i = 0; i < samples; i++)
{
Vector3 samplePos = ray.GetPoint(radius + radius * 1.5f * i);
NavMeshHit hit;
bool didHit = NavMesh.SamplePosition(samplePos,out hit, radius, NavMesh.AllAreas);
if (didHit)
{
hitPoint = hit.position;
return true;
}
}
hitPoint = Vector3.zero;
return false;
}