# Tilted Inverted Pyramid Platform

Tilted Inverted Pyramid Platforms are a type of platform object appearing in Lethal Lava Land and Bowser in the Fire Sea. The platform basically tilts and moves Mario with it.

 Tilting Inverted Pyramid Platform Technical Constants Object Group Surface

## Behavior

The Tilting Inverted Pyramid creates a transformation matrix using its x,y,z coordinates and its x,y,z normal. The pyramid is initialized with x and z-normals of 0, and a y-normal of 1, so that the pyramid will always spawn in with its flat portion facing directly upwards. Once the pyramid is initialized, it behaves by calculating new normals when Mario is standing on it and then tilts and moves Mario with it. When Mario is on the platform, a matrix is formed from the difference between Mario’s x,y,z coordinates and the platforms x,y,z coordinates. This matrix is then multiplied by the transformation matrix to give a new matrix encoding Mario’s position before the platform rotates. The game calculates an approximate distance between Mario’s position and the platform’s position by the usual distance formula √(dx^2+dy^2+dz^2 ), where dx,dz represent the difference between Mario and the platform’s x and z coordinates, and dy is always assumed to be 500. The game then calculates new normal for the pyramid by scaling each factor dx,dy,dz by the approximate distance. Once the new target normals are calculated, the pyramid approaches these values by incrementing the current normal by .01 until they reach a final target normal. Every time the pyramids normals are updated, the platform’s orientation is updated to match. Finally, if Mario is on the pyramid, the game creates a new matrix encoding Mario’s expected new position on the platform and uses the difference between it and the previous position matrix to update Mario’s position.