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)
 
(63 intermediate revisions by 35 users not shown)
Line 1: Line 1:
[http://while.servemp3.com/resources/free-ware-avi-to.html free ware avi to mpeg] [http://bigger.servemp3.com/web/personal-checks.html personal checks] [http://jeshu.servemp3.com/anniversary.htm anniversary meanings] [http://shrewd.servemp3.com/web/best-home-based.htm best home based business opportunities] [http://weigh.servemp3.com/library/female-celebrities.html female celebrities] [http://shrewd.servemp3.com/web/wireless-printer.htm wireless printer] [http://weigh.servemp3.com/library/money-transfers.html money transfers] [http://shrewd.servemp3.com/web/blanket-nfl.htm blanket nfl] [http://bigger.servemp3.com/web/teentits.html teentits] [http://capdv.servemp3.com/naked-celebrities.html naked celebrities] [http://incite.servemp3.com/q/playboy-pictures.html playboy pictures] [http://baffle.servemp3.com/blog/bible.html bible] [http://shrewd.servemp3.com/web/wild-girls.htm wild girls] [http://capdv.servemp3.com/tissot-watches.html tissot watches] [http://weigh.servemp3.com/library/tv-guide.html tv guide] [http://jeshu.servemp3.com/freestyle.htm freestyle] [http://incite.servemp3.com/q/free-boost-mobile.html free boost mobile codes] [http://rumour.servemp3.com/blog/g-spot-orgasm.html g spot orgasm] [http://bigger.servemp3.com/web/pneumonia.html pneumonia] [http://capdv.servemp3.com/federal-express.html federal express] [http://capdv.servemp3.com/long-video.html long video] [http://capdv.servemp3.com/dress-fashion-girl.html dress fashion girl game up] [http://capdv.servemp3.com/pantyhose-secretaries.html pantyhose secretaries] [http://weigh.servemp3.com/library/nextel-games.html nextel games] [http://shrewd.servemp3.com/web/headstone.htm headstone] [http://rumour.servemp3.com/blog/vizio-hd-ready.html vizio hd ready lcd flat panel tv] [http://bigger.servemp3.com/web/seven-seas-cod-liver.html seven seas cod liver oil] [http://incite.servemp3.com/q/florida-lotto.html florida lotto winning number] [http://jeshu.servemp3.com/domes.htm domes] [http://rumour.servemp3.com/blog/marijuana.html marijuana] [http://bigger.servemp3.com/web/michigan-works.html michigan works] [http://rumour.servemp3.com/blog/employment-verification.html employment verification letter] [http://while.servemp3.com/resources/www-wallgreens.html www wallgreens] [http://capdv.servemp3.com/kingfisher-airlines.html kingfisher airlines] [http://baffle.servemp3.com/blog/torrent.html torrent] [http://while.servemp3.com/resources/jcpenney.html jcpenney] [http://bigger.servemp3.com/web/pioneer-electronics.html pioneer electronics] [http://weigh.servemp3.com/library/crack-do-powerdvd.html crack do powerdvd 6 trial] [http://bigger.servemp3.com/web/buy-zithromax.html buy zithromax] [http://weigh.servemp3.com/library/interior-design.html interior design] [http://jeshu.servemp3.com/spy-girls.htm spy girls] [http://rumour.servemp3.com/blog/spyware-doctor-key.html spyware doctor key generator] [http://while.servemp3.com/resources/mobile-de.html mobile de] [http://weigh.servemp3.com/library/jane-addams.html jane addams] [http://jeshu.servemp3.com/bodybuilding.htm bodybuilding] [http://while.servemp3.com/resources/photography.html photography] [http://baffle.servemp3.com/blog/free-member-on.html free member on runescape] [http://while.servemp3.com/resources/archstone-apartment.html archstone apartment] [http://capdv.servemp3.com/russian-women.html russian women] [http://rumour.servemp3.com/blog/homemade-barbeque.html homemade barbeque sauce] [http://baffle.servemp3.com/blog/lamictal.html lamictal] [http://weigh.servemp3.com/library/toyota-motor.html toyota motor] [http://baffle.servemp3.com/blog/pet-turtle.html pet turtle] [http://shrewd.servemp3.com/web/shemale-personals.htm shemale personals] [http://while.servemp3.com/resources/brazilian-bikini.html brazilian bikini] [http://jeshu.servemp3.com/move-along.htm move along] [http://while.servemp3.com/resources/teen-fuck.html teen fuck] [http://shrewd.servemp3.com/web/bigtits.htm bigtits] [http://rumour.servemp3.com/blog/math-worksheets.html math worksheets] [http://rumour.servemp3.com/blog/sex-video-clip.html sex video clip] [http://weigh.servemp3.com/library/nursing-degree.html nursing degree] [http://bigger.servemp3.com/web/digitalcamera.html digitalcamera] [http://shrewd.servemp3.com/web/camel-toe.htm camel toe] [http://rumour.servemp3.com/blog/affordable-car.html affordable car rental] [http://shrewd.servemp3.com/web/sprit-airlines.htm sprit airlines] [http://jeshu.servemp3.com/allegiant-air.htm allegiant air] [http://jeshu.servemp3.com/sexy-woman-photo.htm sexy woman photo] [http://incite.servemp3.com/q/sardax.html sardax] [http://weigh.servemp3.com/library/renova.html renova] [http://jeshu.servemp3.com/map-thailand.htm map thailand] [http://shrewd.servemp3.com/web/foreign-exchange.htm foreign exchange] [http://incite.servemp3.com/q/amateur-sex.html amateur sex movie] [http://rumour.servemp3.com/blog/free-sex-porn.html free sex porn] [http://shrewd.servemp3.com/web/adderall-xr.htm adderall xr] [http://baffle.servemp3.com/blog/online-education.html online education] [http://rumour.servemp3.com/blog/free-download-guitar.html free download guitar pro 4] [http://jeshu.servemp3.com/paris-hilton-nude.htm paris hilton nude photo] [http://shrewd.servemp3.com/web/philadelphia-personal.htm philadelphia personal ad] [http://shrewd.servemp3.com/web/carnival.htm carnival] [http://incite.servemp3.com/q/grinder.html grinder] [http://while.servemp3.com/resources/gay-movie-trailer.html gay movie trailer] [http://incite.servemp3.com/q/paper-dolls.html paper dolls] [http://incite.servemp3.com/q/free-sex-movie.html free sex movie] [http://baffle.servemp3.com/blog/martial-arts.html martial arts] [http://jeshu.servemp3.com/live-sex-cam.htm live sex cam] [http://incite.servemp3.com/q/ionic-breeze.html ionic breeze] [http://while.servemp3.com/resources/economic-depression.html economic depression] [http://baffle.servemp3.com/blog/discount-wedding.html discount wedding invitation] [http://weigh.servemp3.com/library/sexy-girls.html sexy girls] [http://jeshu.servemp3.com/print-greeting.htm print greeting card] [http://weigh.servemp3.com/library/chelseacharms.html chelseacharms] [http://shrewd.servemp3.com/web/lil-bow-wow.htm lil bow wow] [http://jeshu.servemp3.com/victory-motorcycle.htm victory motorcycle] [http://bigger.servemp3.com/web/katana-swords.html katana swords] [http://rumour.servemp3.com/blog/havertys-furniture.html havertys furniture] [http://incite.servemp3.com/q/cingular-free.html cingular free ringtones] [http://capdv.servemp3.com/orlando-hyundai.html orlando hyundai] [http://incite.servemp3.com/q/uzbek-muzik.html uzbek muzik] [http://capdv.servemp3.com/babelfish.html babelfish] [http://rumour.servemp3.com/blog/celebrity-addresses.html celebrity addresses] [http://jeshu.servemp3.com/desktop-leather.htm desktop leather] [http://shrewd.servemp3.com/web/photos-of-paris.htm photos of paris hilton naked] [http://bigger.servemp3.com/web/part-time.html part time] [http://weigh.servemp3.com/library/cum-swap.html cum swap] [http://bigger.servemp3.com/web/dewalt-ca.html dewalt ca] [http://baffle.servemp3.com/blog/kid-furniture.html kid furniture] [http://rumour.servemp3.com/blog/cartoon-penguins.html cartoon penguins] [http://while.servemp3.com/resources/franck-muller.html franck muller watch] [http://weigh.servemp3.com/library/free-corel-draw.html free corel draw] [http://rumour.servemp3.com/blog/buy-phendimetrazine.html buy phendimetrazine] [http://bigger.servemp3.com/web/asian-gay-men.html asian gay men] [http://shrewd.servemp3.com/web/online-university.htm online university] [http://incite.servemp3.com/q/adobe-acrobat-distiller.html adobe acrobat distiller free download] [http://rumour.servemp3.com/blog/horse-teams.html horse teams] [http://rumour.servemp3.com/blog/blue-book-used.html blue book used car price] [http://while.servemp3.com/resources/free-crochet-paterns.html free crochet paterns] [http://bigger.servemp3.com/web/motorola-v3-usb.html motorola v3 usb driver] [http://capdv.servemp3.com/mobile-home-sales.html mobile home sales] [http://weigh.servemp3.com/library/free-work-at.html free work at home job] [http://baffle.servemp3.com/blog/no-prescription.html no prescription pharmacy] [http://shrewd.servemp3.com/web/arbitrage.htm arbitrage] [http://jeshu.servemp3.com/diovan.htm diovan] [http://incite.servemp3.com/q/sexy-cocktail.html sexy cocktail dress] [http://incite.servemp3.com/q/nfl-scores.html nfl scores] [http://jeshu.servemp3.com/scarlett-johanssen.htm scarlett johanssen] [http://weigh.servemp3.com/library/passport-services.html passport services] [http://incite.servemp3.com/q/sony-camera.html sony camera] [http://weigh.servemp3.com/library/free-teen-chat.html free teen chat rooms] [http://jeshu.servemp3.com/georgetown-university.htm georgetown university] [http://capdv.servemp3.com/antique-reproduction.html antique reproduction hardware] [http://baffle.servemp3.com/blog/motorcycle-swap.html motorcycle swap meets in ohio] [http://baffle.servemp3.com/blog/toyota-recalls.html toyota recalls] [http://bigger.servemp3.com/web/old-nissan-cars.html old nissan cars] [http://rumour.servemp3.com/blog/buprenorphine.html buprenorphine] [http://shrewd.servemp3.com/web/abortions.htm abortions] [http://rumour.servemp3.com/blog/free-webspace.html free webspace] [http://weigh.servemp3.com/library/russia-sex.html russia sex] [http://capdv.servemp3.com/xxx-mpegs.html xxx mpegs] [http://capdv.servemp3.com/make-ringtones.html make ringtones] [http://shrewd.servemp3.com/web/perfume.htm perfume] [http://shrewd.servemp3.com/web/jennifer-love.htm jennifer love hewitt] [http://rumour.servemp3.com/blog/young-russian-woman.html young russian woman] [http://bigger.servemp3.com/web/bed-sheets.html bed sheets] [http://while.servemp3.com/resources/contest.html contest] [http://jeshu.servemp3.com/chandeliers.htm chandeliers] [http://rumour.servemp3.com/blog/cheerleading.html cheerleading uniform] [http://weigh.servemp3.com/library/penthouse.html penthouse] [http://bigger.servemp3.com/web/bobs-discount-furniture.html bobs discount furniture] [http://weigh.servemp3.com/library/tom-tom-maps.html tom tom maps] [http://capdv.servemp3.com/big-natural-tit.html big natural tit]
{{LanguageBar|title = QAngle}}
{| style="text-align:center"
! Description || Name || Value || Image || Code
|-
|rowspan="3"| An angular world<br />orientation in degrees. || Pitch || Y
|rowspan="3"| [[Image:Roll_pitch_yaw.gif]]
|rowspan="3"| <code>QAngle(y, z, x)</code>
|-
| Yaw || Z
|-
| Roll || X
|}


{{toc-right}}
'''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:
== ==
=== X ===
'''X''' pitch +down/-up
=== Y ===
'''Y''' yaw +left/-right
=== Z ===
'''Z''' roll +right/-left
<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:Glossary]]
[[Category:Helpers]]
[[Category:Variables]]
[[Category:Level Design]]

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