Table of Contents

VectorToAngles

angle, angle VectorToAngles(fixed x, fixed y, fixed z)

angle - a fixed-point ZDoom angle (not degrees or radians)

This function returns multiple values.

Description

Converts a 3D vector to a pair of angles (yaw and pitch).

Examples

Make the player look along the vector:

VectorToAngles(1.0, 2.0, 3.0);
int angle = r1;
int pitch = r2;

SetActorAngle(tid, angle);
SetActorPitch(tid, -pitch); // Note that actor pitch is inverted in ZDoom.
Use LookAtPoint instead of the example code above.