Ledge Grab: Difference between revisions

158 bytes added ,  26 December 2024
Cite the code and update to include details from code
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''' works as follows: While Mario's position is in the air and against a wall, and he has a non-positive vertical speed, the game checks two conditions.
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 both conditions pass, the game searches for a potential ledge 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.
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.
16

edits