This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| new:units [2018/02/16 19:59] – korshun | new:units [2018/02/17 12:06] (current) – korshun | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Unit conversion ====== | ====== Unit conversion ====== | ||
| - | ACSUtils provides a range of functions to convert various commonly used units. | + | ACSUtils provides a range of functions to convert various commonly used units. All unit conversion |
| - | Using the same units everywhere in your mod is good practice that reduces potential errors. ACSUtils uses the same units in all its functions. | + | Using the same units everywhere in your mod is a good practice that reduces potential |
| ===== Angle units ===== | ===== Angle units ===== | ||
| + | |||
| + | The following angle units are commonly used in ZDoom: | ||
| * ZDoom fixed-point angles [0, 1] | * ZDoom fixed-point angles [0, 1] | ||
| + | * ZDoom byte angles [0 to 256, integers only] | ||
| * Degrees [0, 360] | * Degrees [0, 360] | ||
| * Radians [0, 6.28] | * Radians [0, 6.28] | ||
| - | ZDoom fixed-point angles are the recommended angle unit in ZDoom, used by almost all actor functions, and used by all ACSUtils functions. | + | ZDoom fixed-point angles are the recommended angle unit in ZDoom, used by almost all ZDoom functions, and used by all ACSUtils functions. |
| Angle units can be converted using the following functions (ang = ZDoom fixed-point angles, deg = Degrees, rad = Radians): | Angle units can be converted using the following functions (ang = ZDoom fixed-point angles, deg = Degrees, rad = Radians): | ||
| Line 21: | Line 24: | ||
| * '' | * '' | ||
| * '' | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | ZDoom byte angles can also be converted to ZDoom fixed-point angles this way: | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | Or using bit shifts: | ||
| + | * '' | ||
| + | * '' | ||
| ===== Gravity units ===== | ===== Gravity units ===== | ||
| - | * acceleration (default | + | There are two gravity units in ZDoom: |
| - | * '' | + | |
| - | ZDoom uses '' | + | * acceleration -- mapunits/ |
| + | * '' | ||
| + | |||
| + | ZDoom uses '' | ||
| Gravity units can be converted using the following functions: | Gravity units can be converted using the following functions: | ||
| Line 40: | Line 55: | ||
| ===== Jump height ===== | ===== Jump height ===== | ||
| + | |||
| + | Decorate JumpZ is not the actual jump height of the actor, but a much lower non-linearly related value. | ||
| * '' | * '' | ||
| * '' | * '' | ||