Angle: Difference between revisions

From Ukikipedia
Jump to navigation Jump to search
(Made this because the angular unit page said to. I don't know how to delete pages so someone delete the angular unit page.)
 
(Add HAU)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Angles are a measurement of a separation between two rays.  
'''Angles''' are a measurement of a separation between two rays. Using trigonometry, angles give substantial information relating to the position and velocity of an object.
 


==Yaw, Pitch and Roll==
==Yaw, Pitch and Roll==
Yaw, Pitch, and Roll are the three turning directions that can be used to represent any angle in 3D space. Yaw is the angle along the X-Z axes. This angle is taken relative to the positive Z-axis, meaning that directly facing the positive Z-direction corresponds to an angle of 0, while facing directly away corresponds to 180 degrees. Pitch is the angle along the Y-Z axes.  Roll is taken along the Y-X axes.


TODO
==Trigonometry==
Instead of calculating them in real time, the game uses a look-up table for values of the trigonometric functions Sine and Cosine.
==Angular Unit==
==Angular Unit==
An '''angular unit''' or '''angle unit''' is a unit of measurement that describes an angle, specifically yaw, pitch, and roll. Similarly to how there are 360 [[wikipedia:degree (angle)|degrees]] or 2π [[wikipedia:radian|radians]] in a circle, there are precisely 65536 angular units in a circle. The game's trigonometry look-up table, however, is only 1/16 as precise, so angles from 0 to 15 function exactly the same. Other units of measurement used are [[Hexadecimal Angle Unit]]s, revolutions, the aforementioned degrees and radians, and [[wikipedia:gradian|gradians]].
An '''angular unit''' or '''angle unit''' is a unit of measurement that describes an angle, specifically yaw, pitch, and roll. An angular unit in Super Mario 64 is equal to 1/65536 of a circle. This translates to about .0055 degrees per unit, or about 182 units per degree.
 
==Hexadecimal Angle Unit (HAU)==
One '''hexadecimal angle unit (HAU)''' is equivalent to 16 angle units. It can be useful to discuss angles in terms of HAU because the game's trigonometry calculations drop the 4 least significant bits of an angle before using the look-up table, so two different angles will be considered the same if they are truncated to the same HAU. Since 1 HAU is less than .1 degrees, this is never noticeable in regular gameplay, but it can be an important factor in micro optimizations or with large speed values (e.g. for [[Parallel Universe|PU]] movement).


==Angles in Super Mario 64==
To compute an angle to HAU precision, either right bitshift the angle by 4 with (angle >> 4) or truncate it to the nearest multiple of 16 with (angle - (angle mod 16)).


TODO
[[Category:Mechanics]]

Latest revision as of 00:05, 14 September 2026

Angles are a measurement of a separation between two rays. Using trigonometry, angles give substantial information relating to the position and velocity of an object.

Yaw, Pitch and Roll

Yaw, Pitch, and Roll are the three turning directions that can be used to represent any angle in 3D space. Yaw is the angle along the X-Z axes. This angle is taken relative to the positive Z-axis, meaning that directly facing the positive Z-direction corresponds to an angle of 0, while facing directly away corresponds to 180 degrees. Pitch is the angle along the Y-Z axes. Roll is taken along the Y-X axes.

Trigonometry

Instead of calculating them in real time, the game uses a look-up table for values of the trigonometric functions Sine and Cosine.

Angular Unit

An angular unit or angle unit is a unit of measurement that describes an angle, specifically yaw, pitch, and roll. An angular unit in Super Mario 64 is equal to 1/65536 of a circle. This translates to about .0055 degrees per unit, or about 182 units per degree.

Hexadecimal Angle Unit (HAU)

One hexadecimal angle unit (HAU) is equivalent to 16 angle units. It can be useful to discuss angles in terms of HAU because the game's trigonometry calculations drop the 4 least significant bits of an angle before using the look-up table, so two different angles will be considered the same if they are truncated to the same HAU. Since 1 HAU is less than .1 degrees, this is never noticeable in regular gameplay, but it can be an important factor in micro optimizations or with large speed values (e.g. for PU movement).

To compute an angle to HAU precision, either right bitshift the angle by 4 with (angle >> 4) or truncate it to the nearest multiple of 16 with (angle - (angle mod 16)).