This is an old revision of the document!
All unit conversion function operate on fixed-point numbers, even if ZDoom only uses integers for some of these units.
ZDoom fixed-point angles are the recommended angle unit in ZDoom, used by almost all actor 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):
fixed deg2ang(fixed degrees)
– converts degrees to ZDoom anglefixed rad2ang(fixed radians)
– converts radians to ZDoom anglefixed ang2deg(fixed angle)
– converts ZDoom angle to degreesfixed ang2rad(fixed angle)
– converts ZDoom angle to radiansfixed deg2rad(fixed degrees)
– converts degrees to radiansfixed rad2deg(fixed radians)
– converts radians to degreessv_gravity
units (default gravity is 800)
ZDoom uses sv_gravity
units exclusively, but acceleration is the recommended unit, as it can be used in physical calculations without conversion.
Gravity units can be converted using the following functions:
fixed grav2accel(fixed sv_gravity)
– converts sv_gravity
units to accelerationfixed accel2grav(fixed acceleration)
– converts acceleration to sv_gravity
unitsACSUtils also provides utility functions for manipulating gravity:
fixed GetGravityG()
– reads the value of sv_gravity
, converts it to acceleration and returns the result. Supports both very small and HUGE values of sv_gravity
.void SetGravityG(fixed accel)
– a wrapper for SetGravity that accepts acceleration instead of sv_gravity
units.fixed jumpz2height(fixed jumpz)
– converts decorate JumpZ to actual resulting jump heightfixed height2jumpz(fixed height)
– calculates JumpZ from actual jump height