AngleVectors(): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with ''''<code>AngleVectors()</code>''' converts a <code>QAngle</code> into either one or three normalised <code>Vector</code>s. * If there is only one Vector, it points i…')
 
mNo edit summary
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
'''<code>AngleVectors()</code>''' converts a <code>[[QAngle]]</code> into either one or three [[normal]]ised <code>[[Vector]]</code>s.
{{DISPLAYTITLE:AngleVectors() and VectorAngles()}}
'''<code>AngleVectors()</code>''' converts a <code>[[QAngle]]</code> into either one or three [[normal]]ised <code>[[Vector|Vectors]]</code>.


* If there is only one Vector, it points in the same direction as the QAngle ("forward").
* If there is only one Vector, it points in the same direction as the QAngle ("forward").
* If there are three Vectors, they point forward, right and up respectively.
* If there are three Vectors, they point forward, right and up respectively.


'''<code>VectorAngles()</code>''' converts a single <code>Vector</code> into a <code>QAngle</code>. You can also pass a <code>pseudoup</code> Vector ({{todo|explain}}).
'''<code>VectorAngles()</code>''' converts a single <code>Vector</code> into a <code>QAngle</code>. You can optionally pass a <code>pseudoup Vector</code> which is useful if you're creating the QAngle based on orthogonal axes and don't want to lose rotational information; it will merely determine the roll component of the QAngle.


{{note|None of the functions return values; instead, you must declare all the variables you need beforehand. <code>AngleVectors()</code> requires you to pass pointers while <code>VectorAngles()</code> does not.}}
{{note|None of the functions return values; instead, you must declare all the variables you need beforehand. <code>AngleVectors()</code> requires you to pass pointers while <code>VectorAngles()</code> does not.}}

Latest revision as of 00:17, 5 December 2011

AngleVectors() converts a QAngle into either one or three normalised Vectors.

  • If there is only one Vector, it points in the same direction as the QAngle ("forward").
  • If there are three Vectors, they point forward, right and up respectively.

VectorAngles() converts a single Vector into a QAngle. You can optionally pass a pseudoup Vector which is useful if you're creating the QAngle based on orthogonal axes and don't want to lose rotational information; it will merely determine the roll component of the QAngle.

Note.pngNote:None of the functions return values; instead, you must declare all the variables you need beforehand. AngleVectors() requires you to pass pointers while VectorAngles() does not.

Example

Vector fwd, rt, up;
AngleVectors( myAngle, &fwd, &rt, &up);
QAngle angles;
VectorAngles( myVector, angles );