Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

makevectors

From Quake Wiki

Revision as of 10:21, 31 July 2023 by Boondorl (talk | contribs)

void makevectors(vector angs)

Usage

Takes the passed angles and converts them into its three local axes i.e. its 3D rotation matrix. These axes are stored in the v_forward, v_right, and v_up globals. v_forward points in the direction of the angles, v_right points 90 degrees to the right of v_forward, and v_up points 90 degrees above v_forward. This is useful if you need to offset relative to an angle e.g. in the direction an entity is facing.

Warning: A bug exists with vectoangles() where the pitch is not negated correctly. If you pass the results of this function or the angles field of an entity, the pitch (the x value) must be negated first.

Parameters

  • angs
The angles that will be used to generate the axes as (pitch, yaw, roll).

Example

// Get the axes in the direction the player is looking
makevectors(player.v_angle);

// Offset 1024 map units in the direction the player is looking
traceline(player.origin, player.origin + v_forward*1024, 0, player);