Properly check for being grounded in terrains