diff options
| author | Dragorn421 <Dragorn421@users.noreply.github.com> | 2024-01-18 23:56:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-18 17:56:54 -0500 |
| commit | 5e406f754e490e9f815fe7ca2fc36c10fc909624 (patch) | |
| tree | 3687d6786b77228e861aec572917a9276872c8a2 /src/code/z_lib.c | |
| parent | 90a6268460e9032733c708eb00d124b291256be9 (diff) | |
Small `Math_Vec3f_Yaw` doc (#1433)
* Small `Math_Vec3f_Yaw` doc
* remove actor from arg names
---------
Co-authored-by: fig02 <fig02srl@gmail.com>
Diffstat (limited to 'src/code/z_lib.c')
| -rw-r--r-- | src/code/z_lib.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/code/z_lib.c b/src/code/z_lib.c index fbea9dce4..cc665fd0c 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -300,9 +300,14 @@ f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b) { return b->y - a->y; } -s16 Math_Vec3f_Yaw(Vec3f* a, Vec3f* b) { - f32 dx = b->x - a->x; - f32 dz = b->z - a->z; +/** + * @param origin Position of the origin, the location from which to look at the target `point` + * @param point Position of the target point, in the same space as `origin` + * @return The yaw towards `point` when at `origin`, assuming +z is forwards. + */ +s16 Math_Vec3f_Yaw(Vec3f* origin, Vec3f* point) { + f32 dx = point->x - origin->x; + f32 dz = point->z - origin->z; return Math_Atan2S(dz, dx); } |
