User talk:Kazyan/GLG
A Glitchy Ledge Grab (or GLG) is any ledge grab that raises Mario 151 or more units, compared to the expected maximum of 150 units. This can be accomplished in three main methods with specific wall and floor geometries, which are themselves referred to as GLG spots.
Ledge grab check overview
Glitchy ledge grabs depend on errors in the logic that determines if Mario should grab a ledge above him, which is referred to as the ledge grab check. Mario grabs a ledge above him when the following conditions are met:
- Mario is descending.
- Mario's Y position + 30 is within 50 units of a wall, inclusive.
- Mario's Y position + 150 is not within 50 units of a wall, inclusive.
- There is a floor hitbox within 150 units above Marios' Y position and 60 units laterally into the wall.
Under normal circumstances, this logic detects when Mario is against the top of a wall with a floor upon it, but is falling instead of rising in a jump, and so would not be able to reach the floor. Mario grabs these ledges up to 150 units above his position. GLGs gain more than 150 units of height because floor hitboxes are 78 units thick vertically, and so can satisfy the third condition with only the lower end of a wall hitbox being detected.
Types of GLG
GLG with stacked floors
A GLG can occur with stacked floor hitboxes, where Mario does not grab onto the ledge of the intended floor because a different floor hitbox is directly above it, which Mario grabs instead. This occurs because the scan for floor hitboxes starts at 150 units above Mario and works its way down, rather than starting from Mario's position and scanning up. This allows floor hitboxes with no actual ledges to be grabbed onto, so long as there is an actual ledge both close and directly below it.
GLG from positive wall Y-norm
Some walls are not quite vertical, and tilt backwards away from the vertical plane slightly. Because of this, even is Mario's Y position + 30 is within 50 units of a wall hitbox, Mario's Y position + 150 might be ~50.01 units from the same wall, satisfying the third ledge grab condition. This allows intended ledges to be grabbed from lower down on the wall.