# Surface

A **surface** or **triangle** in Super Mario 64 is a piece of geometry that exerts some kind of force or effect on Mario. Every triangle falls into one of three categories: a floor triangle, a wall triangle, or a ceiling triangle. However, a triangle does not store what category it is. Instead, its category is determined based on the y component of the triangle's normal vector^{[1]}. If y component > 0.01, then it is a floor. If y component < -0.01, then it is a ceiling. Otherwise, it is a wall.

## Walls

A triangle is a wall triangle if and only if -0.01 < normal.y < 0.01.

### Hitbox

All wall hitboxes are handled once per frame and once per quarter step of Mario's movement. Most of the time, a wall has two separate hitboxes handled one after the other within a frame or quarter step.

- A wall hitbox's initial frame handle has a hitbox extending 50 units forward and 50 units backward, offset down 60, and then a hitbox extending 24 units in each direction offset down 30.
- A quarter step of ground movement has a hitbox extending 24 units forward and 24 units backward, offset down 30, and then a hitbox extending 50 units in each direction offset down 60. This is the opposite order from the initial handle, but the outcome is the same.
- A quarter step of air movement gives the wall a hitbox of 50 units in each direction offset down 150, and then a hitbox of 50 units offset down 30.
- Water movement does not implement quarter steps. After one frame of water movement, a wall hitbox extends 110 units in each direction, offset down 10. Since both the water handle and the initial handle both happen once per frame, the hitboxes can be overlaid.