RaycastHit rh;
if (Physics.Raycast(new Vector3(transform.localPosition.x, transform.localPosition.y + 0.2f, transform.localPosition.z), transform.TransformDirection(Vector3.down), out rh, 0.5f))
{
IsGround = true;
}
else
{
IsGround = false;
}
@harizmarok
Try this:
RaycastHit rh;
if (Physics.Raycast(transform.position, -transform.up, out rh, 1f))
{
IsGround = true;
}
else
{
IsGround = false;
}