QAngle: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (Nesciuse moved page QAngle/en to QAngle without leaving a redirect: Move en subpage to basepage)
 
(83 intermediate revisions by 41 users not shown)
Line 1: Line 1:
[http://roycemotor.com/carpics/cache/aiigxq.html adobe premiere plugins] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/ncftfr.html property tax virginia west] [http://www.youthfitnesssolutions.com/FTP1/page9/ucroms.html literary devices drama] [http://xuccco.org/themes/AT-Green3/fvaobw.html stephen kings it cast list] [http://ankelia-nature.com/catalogues/catalogues/dgolpj.html west point virginia public schools] [http://indianaoutfitters.com/s/info/tmp/cjskli.html aspire yes com] [http://asie-voyages.com/upload/images/lens/wimxge.html recording shop] [http://hoosierfishing.com/phpBB/images/avatars/avatar/hciusq.html anthropology gender studies] [http://roycemotor.com/carpics/cache/enhqej.html nanotechnology solar] [http://roycemotor.com/carpics/cache/ciolkj.html muse official homepage] [http://www.biblored.org.co/agenda_actividades/programas/images/anqmhc.html variety show idea] [http://smallbizbohol.com/democatalog/images/baner/xaklov.html the tower theater philadelphia] [http://talentmodeles.com/mannequin/images/cache/guvupe.html sir studios new york] [http://coastguard.gov.ph/content.old/license/vluvml.html la aula] [http://www.hdac.org/hdfaq/faq/okrijq.html things to say in a birthday card] [http://www.lewakins.com/sr/images/eseocl.html arizona college interest] [http://asie-voyages.com/upload/images/lens/sjqice.html train travel virgin] [http://www.lewakins.com/sr/images/efewsi.html samantha ryan sports] [http://tch-voyages.com/documents/prague/896/nklncm.html network tv computer] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/mjurrk.html as you would be] [http://www.biblored.org.co/agenda_actividades/programas/images/cgbjtm.html welch allen] [http://tch-voyages.com/documents/prague/896/vtupcc.html insert html email image] [http://roycemotor.com/carpics/cache/qbqdow.html savannah georgia phone directory] [http://smallbizbohol.com/democatalog/images/baner/arkkwb.html play any media file] [http://tch-voyages.com/documents/prague/896/jtxdqd.html venezuela tachira] [http://smallbizbohol.com/democatalog/images/baner/oinfro.html 2000 greetings .com] [http://talentmodeles.com/mannequin/images/cache/pclucr.html agent modeling teen] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/mjrfap.html under monitor power center] [http://asie-voyages.com/upload/images/lens/okmiml.html messy fight] [http://indianaoutfitters.com/s/info/tmp/divpvp.html object relational database system] [http://panties-pictures.com/free/lib/temp/vgqjrc.html laos travel agency] [http://www.norcab.com.au/joeavatiforum/templates/cache/pijmtk.html index of indian girl] [http://www.biblored.org.co/agenda_actividades/programas/images/vwmdog.html index of indian girl] [http://xuccco.org/themes/AT-Green3/kphjuo.html window 2000 hardware requirement] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/dmfkml.html used guitar case] [http://indianaoutfitters.com/s/info/tmp/fccomi.html matrix dvd] [http://tarsierfoundation.org/content/license/fakths.html scavo] [http://www.biblored.org.co/agenda_actividades/programas/images/rurqqq.html revisorer] [http://coastguard.gov.ph/content.old/license/vjbvjt.html mumps with cache] [http://panties-pictures.com/free/lib/temp/moppan.html religions in south america] [http://panties-pictures.com/free/lib/temp/ajmufk.html alexander the greats invasion of india] [http://tch-voyages.com/documents/prague/896/xqnwat.html intimate apparel review] [http://indianaoutfitters.com/s/info/tmp/vujisc.html xxx photo gallery] [http://panties-pictures.com/free/lib/temp/lhkjoi.html white female rapper] [http://www.lewakins.com/sr/images/nacokw.html medical defence union scotland] [http://xuccco.org/themes/AT-Green3/kgumff.html separating audio] [http://tch-voyages.com/documents/prague/896/vbbxwa.html early years activity] [http://ankelia-nature.com/catalogues/catalogues/cuxjjv.html auto body canadian part] [http://lumayagrealty.com/catalog/images/pics/xupwmo.html motives for war in iraq] [http://tarsierfoundation.org/content/license/wifqvf.html merging voices] [http://smallbizbohol.com/democatalog/images/baner/ecwxhb.html missy elliot hot boyz] [http://tarsierfoundation.org/content/license/pungna.html extreme foot job] [http://smallbizbohol.com/democatalog/images/baner/stnjxn.html inter mediates] [http://www.redacademica.edu.co/manejocorreo/Cliente/cache/hfxxbi.html w.a.s.p.s.] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/rsmego.html 101 buying home] [http://smallbizbohol.com/democatalog/images/baner/lwgvpo.html 20 coin dollar gold us] [http://indianaoutfitters.com/s/info/tmp/ceepul.html state infrastructure bank california] [http://lumayagrealty.com/catalog/images/pics/lqmsbp.html web master newsletter] [http://asie-voyages.com/upload/images/lens/xescan.html texas bar associations] [http://www.norcab.com.au/joeavatiforum/templates/cache/ifrcca.html animal movie free] [http://www.lewakins.com/sr/images/qoporq.html latino music stand up video] [http://indianaoutfitters.com/s/info/tmp/travwa.html student led conferences forms] [http://www.youthfitnesssolutions.com/FTP1/page9/wruvdp.html young authors conference ohio] [http://xuccco.org/themes/AT-Green3/amqhok.html kim model next top] [http://panties-pictures.com/free/lib/temp/sfmrjn.html man treat] [http://talentmodeles.com/mannequin/images/cache/tloenk.html white bump on back of tongue] [http://ankelia-nature.com/catalogues/catalogues/gwkhvd.html sky plus hard drive upgrade] [http://www.redacademica.edu.co/manejocorreo/Cliente/cache/megvmj.html outcome evaluation] [http://www.youthfitnesssolutions.com/FTP1/page9/heatsq.html accident depot home] [http://www.biblored.org.co/agenda_actividades/programas/images/kmxvvc.html salary of radiologist] [http://tch-voyages.com/documents/prague/896/meqkax.html el cope] [http://tarsierfoundation.org/content/license/hnlbnm.html montrez] [http://lumayagrealty.com/catalog/images/pics/famiwl.html suburban fine arts center] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/inggmv.html stopping junk mail] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/sgxuwq.html telegraph calcutta] [http://coastguard.gov.ph/content.old/license/vxqhpd.html two set of twins] [http://hoosierfishing.com/phpBB/images/avatars/avatar/cchkvx.html post doctoral fellowships history] [http://coastguard.gov.ph/content.old/license/owaumd.html marriage certificate in massachusetts] [http://panties-pictures.com/free/lib/temp/nggqbs.html johnson central high school] [http://www.hdac.org/hdfaq/faq/pplbdw.html ex smith wife will] [http://tch-voyages.com/documents/prague/896/ohmfvr.html side by side fridge] [http://www.biblored.org.co/agenda_actividades/programas/images/tusule.html mass transit magazines] [http://hoosierfishing.com/phpBB/images/avatars/avatar/jrmcad.html relational algebra databases] [http://lumayagrealty.com/catalog/images/pics/mjgsik.html service magazine] [http://coastguard.gov.ph/content.old/license/fargcr.html queen band member] [http://tch-voyages.com/documents/prague/896/lgvtbr.html western canada lotteries corp] [http://smallbizbohol.com/democatalog/images/baner/bheeit.html wius station house] [http://panties-pictures.com/free/lib/temp/ucugam.html widespread panic shows] [http://tch-voyages.com/documents/prague/896/jhougq.html edging machine metal sheet] [http://www.youthfitnesssolutions.com/FTP1/page9/ftmbvw.html ice cream scoopers] [http://talentmodeles.com/mannequin/images/cache/fptdks.html monologue play] [http://www.redacademica.edu.co/manejocorreo/Cliente/cache/egrksh.html let me in unlock the door] [http://roycemotor.com/carpics/cache/xholeo.html war clan names] [http://hoosierfishing.com/phpBB/images/avatars/avatar/mdujvq.html transportation planning minnesota] [http://smallbizbohol.com/democatalog/images/baner/sphcdc.html kenyas population 2004] [http://tch-voyages.com/documents/prague/896/fdowvg.html storyboards for commercial] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/hoggql.html software to play music backwards] [http://ankelia-nature.com/catalogues/catalogues/gjwncn.html may festival youth chorus] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/ilhcob.html industrial economy definition] [http://panties-pictures.com/free/lib/temp/npbgaw.html real services time xray]
{{LanguageBar|title = QAngle}}
{| style="text-align:center"
 
! Description || Name || Value || Image || Code
{{toc-right}}
|-
 
|rowspan="3"| An angular world<br />orientation in degrees. || Pitch || Y
'''QAngle''' is a C++ class in [[Source]] that represents a three-dimensional [[Wikipedia: Extrinsic rotations|extrinsic Tait-Bryan rotations]] following the [[Wikipedia: Right-hand rule|right-hand rule]], offset from the cardinal [[Coordinates|Z axis]]. Each QAngle contains three [[vec t]] rotation values:  
|rowspan="3"| [[Image:Roll_pitch_yaw.gif]]
== ==
|rowspan="3"| <code>QAngle(y, z, x)</code>
=== X ===
|-
'''X''' pitch +down/-up
| Yaw || Z
=== Y ===
|-
'''Y''' yaw +left/-right
| Roll || X
=== Z ===
|}
'''Z''' roll +right/-left
[[Category:Glossary]] [[Category:Helpers]] [[Category:Level Design]]
 
<code>(-45,10,0)</code> means 45° up, 10° left and 0° roll.
 
{{tip|The axes are sometimes called rX, rY and rZ to distinguish them from [[vector]] axes.}}
 
{{note|Z is clamped to +/-50 for player viewangles.}}
 
== Declaration ==
 
QAngle angMyAngle = QAngle(-45,10,0);
 
* You could also assign to the X, Y and Z member variables separately.
* The prefix <code>ang</code> (or sometimes just <code>a</code>) identifies the variable as an angle.
 
== Orientation ==
 
To get a feeling for how a <code>QAngle([X], [Y], [Z])</code> works, imagine a first-person perspective:  
 
* Looking down or up corresponds to positive or negative [X]
* Looking left or right corresponds to positive or negative [Y]
* Tilting your head so your right or left ear faces the ground corresponds to positive or negative [Z]
 
To relate this back to vectors and coordinates: The values of [X], [Y], and [Z] correspond to a clockwise rotation (in degrees) around the [[Coordinates|absolute axes]]{{confirm}} y, z, and x, respectively.  
 
"Clockwise rotation" in an axis assumes the viewer is located at the origin looking in the positive direction of said axis.
 
=== Naming Conventions ===
 
Different fields use different naming conventions to describe these angles. To clear up any conflicting terms, short explanations are included below. Source Engine seems to draw its lingo from Aerospace Engineering.
 
'''Aerospace Engineering'''
 
{{Expand|When imagining a plane, pitch moves the nose up and down, yaw moves the nose left and right, and roll causes one wing to move up and the other wing to move down.
[[Wikipedia: Aircraft principal axes|In Aerospace Engineering]], this system is also referred to as Euler angles if — unlike QAngles — the axes rotate along. See "Mathematics" for clarification.}}
 
'''Mathematics'''
 
{{Expand| Strictly speaking, QAngles would be defined as [[Wikipedia: Extrinsic rotations|extrinsic Tait-Bryan rotations]] following the [[Wikipedia: Right-hand rule|right-hand rule]]. The terms "Tait-Bryan angles" and "Euler angles" are sometimes used interchangeably however. Breaking down this name into digestible chunks:
 
* The difference between [[Wikipedia: Extrinsic rotations|intrinsic and extrinsic rotations]], is that with the former, each rotation shifts the axes along with it
* The difference between [[Wikipedia: Euler angles|proper Euler angles and Tait-Bryan angles]], is that the former rotates twice around one axis and once around another (alternatingly), while the latter rotates once around all three axes
* The [[Wikipedia: right-hand rule|right-hand rule]] states that if the thumb of one's right hand is pointing along the positive direction of an axis, their other fingers will curl in the positive direction of rotation
 
{{tip|Since many conflicting definitions are used in rotation, being explicit when it comes to naming can help avoid confusion}} }}
 
== Converting from Vector ==
 
As there is no specific [[Data Descriptions#DEFINE FIELD|datadesc keyfield]] for angles, one chosen in Hammer will arrive as a [[vector]]. Its ordinates will represent degrees of rotation and not coordinates so it must be fixed up before use:
 
<source lang=cpp>
QAngle angMyAngle = QAngle(vecFromHammer.x, vecFromHammer.y, vecFromHammer.z);
 
// Conversion back to a vector, if required
AngleVectors(angMyAngle, &vecFromHammer);</source>
 
== Presence ==
 
* SP 2013 ([https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/mathlib/vector.h#L1661 blob] [https://github.com/ValveSoftware/source-sdk-2013/blob/master/sp/src/public/mathlib/vector.h#L1661 master])
* MP 2013 ([https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/public/mathlib/vector.h#L1661 blob] [https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/public/mathlib/vector.h#L1661 master])
 
== See also ==
 
* [[Wikipedia:Yaw, pitch, and roll]]
* [[getpos]]
* [[Vector]] and [[Coordinates]]
* [[AngleVectors()|<code>AngleVectors()</code> / <code>VectorAngles()</code>]]
 
[[Category:Source class]]
[[Category:Glossary]]
[[Category:Variables]]

Latest revision as of 09:40, 12 July 2024

English (en)Deutsch (de)Русский (ru)中文 (zh)Translate (Translate)

QAngle is a C++ class in Source that represents a three-dimensional extrinsic Tait-Bryan rotations following the right-hand rule, offset from the cardinal Z axis. Each QAngle contains three vec t rotation values:

X

X pitch +down/-up

Y

Y yaw +left/-right

Z

Z roll +right/-left

(-45,10,0) means 45° up, 10° left and 0° roll.

Tip.pngTip:The axes are sometimes called rX, rY and rZ to distinguish them from vector axes.
Note.pngNote:Z is clamped to +/-50 for player viewangles.

Declaration

QAngle angMyAngle = QAngle(-45,10,0);
  • You could also assign to the X, Y and Z member variables separately.
  • The prefix ang (or sometimes just a) identifies the variable as an angle.

Orientation

To get a feeling for how a QAngle([X], [Y], [Z]) works, imagine a first-person perspective:

  • Looking down or up corresponds to positive or negative [X]
  • Looking left or right corresponds to positive or negative [Y]
  • Tilting your head so your right or left ear faces the ground corresponds to positive or negative [Z]

To relate this back to vectors and coordinates: The values of [X], [Y], and [Z] correspond to a clockwise rotation (in degrees) around the absolute axes[confirm] y, z, and x, respectively.

"Clockwise rotation" in an axis assumes the viewer is located at the origin looking in the positive direction of said axis.

Naming Conventions

Different fields use different naming conventions to describe these angles. To clear up any conflicting terms, short explanations are included below. Source Engine seems to draw its lingo from Aerospace Engineering.

Aerospace Engineering

When imagining a plane, pitch moves the nose up and down, yaw moves the nose left and right, and roll causes one wing to move up and the other wing to move down.

In Aerospace Engineering, this system is also referred to as Euler angles if — unlike QAngles — the axes rotate along. See "Mathematics" for clarification.

Mathematics

Strictly speaking, QAngles would be defined as extrinsic Tait-Bryan rotations following the right-hand rule. The terms "Tait-Bryan angles" and "Euler angles" are sometimes used interchangeably however. Breaking down this name into digestible chunks:
  • The difference between intrinsic and extrinsic rotations, is that with the former, each rotation shifts the axes along with it
  • The difference between proper Euler angles and Tait-Bryan angles, is that the former rotates twice around one axis and once around another (alternatingly), while the latter rotates once around all three axes
  • The right-hand rule states that if the thumb of one's right hand is pointing along the positive direction of an axis, their other fingers will curl in the positive direction of rotation
Tip.pngTip:Since many conflicting definitions are used in rotation, being explicit when it comes to naming can help avoid confusion

Converting from Vector

As there is no specific datadesc keyfield for angles, one chosen in Hammer will arrive as a vector. Its ordinates will represent degrees of rotation and not coordinates so it must be fixed up before use:

QAngle angMyAngle = QAngle(vecFromHammer.x, vecFromHammer.y, vecFromHammer.z);

// Conversion back to a vector, if required
AngleVectors(angMyAngle, &vecFromHammer);

Presence

See also