A ledge grab works as follows: While Mario is falling with non-positive vertical speed, the game checks if there's a wall 30 units above him and that there's no wall 150 units above him. If this passes, then it considers a point 60 units towards the wall from Mario (i.e. 10 units into the wall) and 160 units above Mario. It then checks what the highest floor is from 78 units above that point to 100 units below that point. If a floor is found, then Mario grabs the ledge.
Given these conditions, a ledge grab normally raises Mario between 30 units (inclusive) and 150 units (exclusive). However, it's possible to exploit this logic to do a glitchy ledge grab and raise Mario more than 150 units (though 238 units is the max possible raise). You can read more about glitchy ledge grabs here:
Anyway, the condition that makes glitchy ledge grabs rarely possible in practice is that there can't be a wall 150 units above Mario. Fortunately, even minor deviations from perfect geometry can cause there to be no wall 150 units above Mario. For example:
(1) If the wall is slightly slanted forward
(2) If there are 2 walls meant to be coplanar that aren't
(3) If there are 2 parallel walls with the lower one jutting out more
All of these situations have been known, but there was one situation that Tyler Kehne theorized about long ago, which was never demonstrated in practice. And that situation is using a wall gap to prevent there from being a wall 150 units above Mario, which is what I demonstrate in the video.
Wall hitboxes have inclusive edges, meaning that there shouldn't be any gaps on the seam between 2 walls (instead, both walls should cover every point on their seam). However, the float calculations used for wall detection aren't perfect due to float imprecision, meaning that it's possible for a point on the seam to not be included in either wall. In the video, there are several wall gaps on the seam between the 2 wall triangles that are shown. Thus, I positioned Mario float-perfectly so that the point 150 units above him lay exactly at one of these wall gaps, ultimately allowing the glitchy ledge grab to happen.
My process of making this video was as follows: First I searched around various courses looking for a spot to demonstrate this trick, which required 2 walls with wall gaps at the right height, and the top of the walls had to be at a height that Mario could jump ~238 units under (i.e. no walls too short or too tall). Then I used a brute forcer program to calculate movement that would allow Mario to jump to the exact right height (which was only feasible because initial vertical speed during a jump is proportional to horizontal speed, so there were lots of possibilities for y positions in the air). Once I found a way to get the right height, I used a second program to calculate horizontal movement into the right lateral position. And once that found a solution, it was history.
Note that the red coin clone in the video was placed there to demonstrate the exact point Mario had to enter to do the glitchy ledge grab. You could jump at that point a billion times and never get the glitchy ledge grab, because it's float-perfect on the Y and Z axes. Also, the first jump I do in the video goes above the red coin and fails to grab the ledge, which was done to demonstrate that a normal ledge grab doesn't suffice from the red coin's height.
Thanks to JoshDuMan ( for providing me with the necessary code for my brute forcer programs.
0 Comments