Рет қаралды 42,773
I explain all about how angles work in SM64. Angles are stored as shorts, and so they have 65536 possible values, from 0 to 65535. Specifically, angle 0 is along the +Z axis, and angles increase in the counterclockwise direction. Thus, there are 65536 angle units in a complete circle. The four cardinal angles are:
- angle 0 for the +Z axis
- angle 16384 for the +X axis
- angle 32768 for the -Z axis
- angle 49152 for the -X axis
Furthermore, although Mario can have any of the 65536 possible angle values, the game truncates an angle to the nearest multiple of 16 before applying trig functions to it. Consequently, in practice there are only 65536 / 16 = 4096 unique angles to work with. I also explain how this coarse-grained granularity of the angles makes it difficult to perform PU movement. Finally, I go over angular velocity, and how fast various objects are able to turn.
Here's a list of the associated trig value for every possible angle: docs.google.com/spreadsheets/.... Thanks to Peter Fedak for collecting that data from the trig table in memory and giving it to me.
Thanks to Kaze for making the ROM hack that shows Mario's angle. If you want that ROM hack (or any other ROM hack I've shown), you can download them from here:
drive.google.com/open?id=0B3J...
Additional Notes
(1) The game actually considers angles as signed shorts instead of unsigned shorts. Consequently, angles would actually be in the range -32768 to 32767 inclusive, rather than 0 to 65535 inclusive. However, whether the shorts are signed or unsigned doesn't affect how angles are handled at all. Additionally, several other TASers and I prefer the unsigned notation, as it's easier to work with and conceptualize. So feel free to treat angles whichever way you like. To convert between notations, the values -32768 to -1 correspond to the values 32768 to 65535, respectively.
(2) For some objects (namely rotating platforms), their angles use 4 bytes instead of just 2 bytes. However, the upper 2 bytes have no effect in practice, and so one can still think of their angle as just the lower two bytes (i.e. a short).
(3) Objects in SM64 actually have 3 angles: yaw, pitch, and roll. Diagram for reference: i.imgur.com/E05roYE.png. All three of these rotations ascribe 65536 angle units to one full rotation. This video mainly only considered objects' yaw, with the exception of the TTC spinners, in which case it considered their pitch.
(4) I mentioned the terms "granularity", "fine-grained", and "coarse-grained". If you are unfamiliar with these terms, you can read more about them here: en.wikipedia.org/wiki/Granula.... To summarize from that article:
- granularity refers to the extent to which an entity can be subdivided into smaller, discrete parts
- fine-grained means it can be subdivided into a relatively high number of discrete parts (thereby seeming continuous)
- coarse-grained means it can only be subdivided into a relatively low number of discrete parts (thereby breaking the illusion of being continuous)