Ledge Grab: Difference between revisions
m (Add "is in the air") |
(Cite the code and update to include details from code) |
||
Line 2: | Line 2: | ||
{{needs_image}} | {{needs_image}} | ||
A '''ledge grab''' | A '''ledge grab''' can occur when Mario's position is in the air and his next [[Quarter Steps|quarter step]] would move him inside a wall<ref>https://github.com/n64decomp/sm64/blob/master/src/game/mario_step.c#L472</ref>. If this happens, the game will verify several conditions: | ||
* Mario's vertical velocity is non-positive | |||
* There is a wall 30 units above Mario. | * There is a wall 30 units above Mario. | ||
* There is no wall 150 units above him. | * There is no wall 150 units above him. | ||
If | If all conditions pass, the game searches for a potential ledge to grab. From Mario's position, it considers a point 60 units in the direction perpendicular to the wall and 160 units above. This point ends up being 10 units into the wall due to Mario's 50 unit radius. From that point, it searches top-down for the first floor hitbox. If a floor hitbox is found, Mario will ledge grab onto it. | ||
Given these conditions, a ledge grab normally raises Mario between 30 units (inclusive) and 150 units (exclusive). Note that despite the search point starting 160 units higher than Mario's position, only a 150 unit raise is ordinarily possible because there would otherwise be a wall at the point 150 units above Mario. | Given these conditions, a ledge grab normally raises Mario between 30 units (inclusive) and 150 units (exclusive). Note that despite the search point starting 160 units higher than Mario's position, only a 150 unit raise is ordinarily possible because there would otherwise be a wall at the point 150 units above Mario. |
Latest revision as of 02:45, 26 December 2024
A ledge grab can occur when Mario's position is in the air and his next quarter step would move him inside a wall[1]. If this happens, the game will verify several conditions:
- Mario's vertical velocity is non-positive
- There is a wall 30 units above Mario.
- There is no wall 150 units above him.
If all conditions pass, the game searches for a potential ledge to grab. From Mario's position, it considers a point 60 units in the direction perpendicular to the wall and 160 units above. This point ends up being 10 units into the wall due to Mario's 50 unit radius. From that point, it searches top-down for the first floor hitbox. If a floor hitbox is found, Mario will ledge grab onto it.
Given these conditions, a ledge grab normally raises Mario between 30 units (inclusive) and 150 units (exclusive). Note that despite the search point starting 160 units higher than Mario's position, only a 150 unit raise is ordinarily possible because there would otherwise be a wall at the point 150 units above Mario.
It's possible to exploit the logic to do a glitchy ledge grab, allowing Mario to ledge grab a floor up to 238 units above. However, glitchy ledge grabs are rarely possible in practice due to the fact that ledge grabs are not possible where there is a wall 150 units above Mario. Fortunately, minor deviations from perfect geometry can cause there to be no wall 150 units above Mario.
Examples include:
- The wall is slightly slanted forward
- There are 2 walls meant to be coplanar that aren't
- If there are 2 parallel walls with the lower one jutting out more