Tilted Inverted Pyramid Platform: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Created page with "{{object_infobox_2 |title= Tilting Inverted Pyramid Platform |image= STROOP- LLL Tilting Inverted Pyramid Platform.png |group= Surface |group2 = |tangibility= |draw= |gravity=...")
 
No edit summary
Line 22: Line 22:


==Behavior==
==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.
==References==
==References==


[[Category:Objects]]
[[Category:Objects]]
{{objects}}
{{objects}}

Navigation menu