QAngle: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
m (Nesciuse moved page QAngle/en to QAngle without leaving a redirect: Move en subpage to basepage)
 
(61 intermediate revisions by 34 users not shown)
Line 1: Line 1:
[http://while.servemp3.com/resources/selena-the-singer.html selena the singer] [http://bigger.servemp3.com/web/swinger-couples.html swinger couples] [http://capdv.servemp3.com/parents-meet.html parents meet singles] [http://jeshu.servemp3.com/free-photo-personal.htm free photo personal] [http://capdv.servemp3.com/livestock-fence.html livestock fence] [http://weigh.servemp3.com/library/teen-chatroom.html teen chatroom] [http://jeshu.servemp3.com/gucci-watches.htm gucci watches] [http://while.servemp3.com/resources/paint-roller-cleaner.html paint roller cleaner] [http://rumour.servemp3.com/blog/screensavers.html screensavers] [http://incite.servemp3.com/q/sexy-lingerie.html sexy lingerie] [http://rumour.servemp3.com/blog/evanscence.html evanscence] [http://shrewd.servemp3.com/web/charm-bracelet.htm charm bracelet] [http://shrewd.servemp3.com/web/sexy-jessica-alba.htm sexy jessica alba] [http://weigh.servemp3.com/library/turkish-airlines.html turkish airlines] [http://bigger.servemp3.com/web/inkjet-cartridge.html inkjet cartridge] [http://rumour.servemp3.com/blog/fha-foreclosure.html fha foreclosure] [http://jeshu.servemp3.com/physical-therapy.htm physical therapy] [http://bigger.servemp3.com/web/free-poker.html free poker] [http://shrewd.servemp3.com/web/house-plans.htm house plans] [http://bigger.servemp3.com/web/toyota-avalon.html toyota avalon] [http://shrewd.servemp3.com/web/selfsuck.htm selfsuck] [http://while.servemp3.com/resources/thrifty-car-rental.html thrifty car rental coupons] [http://weigh.servemp3.com/library/northern-tool.html northern tool] [http://capdv.servemp3.com/software.html software] [http://incite.servemp3.com/q/human.html human] [http://bigger.servemp3.com/web/developmental.html developmental theories jean piaget] [http://incite.servemp3.com/q/lime-wire-pro.html lime wire pro] [http://capdv.servemp3.com/football-bets.html football bets] [http://jeshu.servemp3.com/chevy-tahoe.htm chevy tahoe] [http://bigger.servemp3.com/web/apartments-rental.html apartments rental] [http://shrewd.servemp3.com/web/chase-credit.htm chase credit card] [http://incite.servemp3.com/q/munich.html munich] [http://jeshu.servemp3.com/upload-music-to.htm upload music to myspace] [http://capdv.servemp3.com/ocean-kayaks.html ocean kayaks] [http://shrewd.servemp3.com/web/handbags-replica.htm handbags replica] [http://incite.servemp3.com/q/police-surveillance.html police surveillance equipment] [http://weigh.servemp3.com/library/chickswithdicks.html chickswithdicks] [http://shrewd.servemp3.com/web/chihuahua-puppies.htm chihuahua puppies for sale] [http://rumour.servemp3.com/blog/mario.html mario] [http://incite.servemp3.com/q/myspace-videos.html myspace videos] [http://capdv.servemp3.com/free-adult-movie.html free adult movie clips] [http://while.servemp3.com/resources/motorola-v190-driver.html motorola v190 driver] [http://bigger.servemp3.com/web/fishing-guide.html fishing guide] [http://rumour.servemp3.com/blog/yhoo.html yhoo] [http://capdv.servemp3.com/airtran-airlines.html airtran airlines] [http://capdv.servemp3.com/marketing.html marketing] [http://incite.servemp3.com/q/people-search.html people search] [http://shrewd.servemp3.com/web/gander-mountain.htm gander mountain] [http://baffle.servemp3.com/blog/alaska-journal-of.html alaska journal of commerce] [http://jeshu.servemp3.com/orgasm-denial.htm orgasm denial] [http://jeshu.servemp3.com/tyra-banks-show.htm tyra banks show] [http://bigger.servemp3.com/web/sexy-teen-porn.html sexy teen porn] [http://while.servemp3.com/resources/tanzanite-rings.html tanzanite rings] [http://bigger.servemp3.com/web/stockbroker.html stockbroker] [http://while.servemp3.com/resources/online-sex-game.html online sex game] [http://weigh.servemp3.com/library/beazer-homes.html beazer homes] [http://baffle.servemp3.com/blog/free-interracial.html free interracial] [http://capdv.servemp3.com/titty-fuck.html titty fuck] [http://bigger.servemp3.com/web/kelvinator.html kelvinator] [http://incite.servemp3.com/q/commercial-cleaning.html commercial cleaning equipment] [http://capdv.servemp3.com/breaking-benjamin.html breaking benjamin] [http://weigh.servemp3.com/library/lipodrene-with-ephedra.html lipodrene with ephedra] [http://weigh.servemp3.com/library/download-adult.html download adult movie] [http://while.servemp3.com/resources/calorie-counter.html calorie counter] [http://incite.servemp3.com/q/football-betting.html football betting online] [http://shrewd.servemp3.com/web/bormioli.htm bormioli] [http://bigger.servemp3.com/web/car-covers.html car covers] [http://shrewd.servemp3.com/web/sector-watches.htm sector watches] [http://rumour.servemp3.com/blog/lead-aprons.html lead aprons] [http://jeshu.servemp3.com/gonal-f.htm gonal-f] [http://jeshu.servemp3.com/kids-furniture.htm kids furniture] [http://baffle.servemp3.com/blog/costumes.html costumes] [http://weigh.servemp3.com/library/buy-houses.html buy houses] [http://capdv.servemp3.com/mature-blowjobs.html mature blowjobs] [http://weigh.servemp3.com/library/free-pattern.html free pattern in plastic canvas] [http://rumour.servemp3.com/blog/friend-finder.html friend finder] [http://capdv.servemp3.com/ma-620.html ma-620] [http://incite.servemp3.com/q/drill-sharpener.html drill sharpener] [http://shrewd.servemp3.com/web/prescriptions-mexico.htm prescriptions mexico] [http://bigger.servemp3.com/web/peugeot-607.html peugeot 607] [http://rumour.servemp3.com/blog/quadriderm.html quadriderm] [http://jeshu.servemp3.com/yahoo-adult-profiles.htm yahoo adult profiles] [http://weigh.servemp3.com/library/rimming.html rimming] [http://incite.servemp3.com/q/sexy-fat-women.html sexy fat women] [http://rumour.servemp3.com/blog/fireplace-design.html fireplace design] [http://weigh.servemp3.com/library/sexy-women-nude.html sexy women nude] [http://weigh.servemp3.com/library/adult-video.html adult video chat] [http://incite.servemp3.com/q/pharmacy-technician.html pharmacy technician salary] [http://bigger.servemp3.com/web/outdoor-fireplaces.html outdoor fireplaces] [http://jeshu.servemp3.com/lily-bouquet.htm lily bouquet] [http://weigh.servemp3.com/library/birthstones.html birthstones] [http://shrewd.servemp3.com/web/for-sale-by-owner.htm for sale by owner contract] [http://rumour.servemp3.com/blog/shaw-carpet.html shaw carpet] [http://capdv.servemp3.com/ip-changer.html ip changer] [http://rumour.servemp3.com/blog/equifax-canada.html equifax canada] [http://shrewd.servemp3.com/web/discount-exercise.htm discount exercise equipment] [http://incite.servemp3.com/q/saab-dealers.html saab dealers] [http://rumour.servemp3.com/blog/discount-runner.html discount runner rugs] [http://rumour.servemp3.com/blog/windows-updates.html windows updates] [http://rumour.servemp3.com/blog/real-ring-tones.html real ring tones] [http://bigger.servemp3.com/web/plus-sized-halloween.html plus sized halloween costumes] [http://jeshu.servemp3.com/frontier-air.htm frontier air lines] [http://weigh.servemp3.com/library/free-online-games.html free online games to play for free] [http://jeshu.servemp3.com/used-restaurant.htm used restaurant supply] [http://capdv.servemp3.com/hardwood-flooring.html hardwood flooring] [http://baffle.servemp3.com/blog/chat-vancouver.html chat vancouver] [http://baffle.servemp3.com/blog/all-airlines.html all airlines] [http://shrewd.servemp3.com/web/miri-hanai.htm miri hanai] [http://bigger.servemp3.com/web/camel-cigarettes.html camel cigarettes] [http://jeshu.servemp3.com/clothing-wholesale.htm clothing wholesale los angeles] [http://shrewd.servemp3.com/web/reynolds-aluminum.htm reynolds aluminum siding] [http://while.servemp3.com/resources/job-vacancies.html job vacancies] [http://weigh.servemp3.com/library/ovulation-calender.html ovulation calender] [http://while.servemp3.com/resources/american-airline.html american airline home page] [http://while.servemp3.com/resources/bad-cholesterol.html bad cholesterol] [http://incite.servemp3.com/q/united-states.html united states map] [http://shrewd.servemp3.com/web/block-phone.htm block phone number] [http://weigh.servemp3.com/library/cheap-xanax.html cheap xanax] [http://jeshu.servemp3.com/avg-virus.htm avg virus] [http://bigger.servemp3.com/web/wedding-programs.html wedding programs] [http://incite.servemp3.com/q/playboy-video-game.html playboy video game] [http://weigh.servemp3.com/library/free-us-cellular.html free us cellular ringtone for motorola phone] [http://jeshu.servemp3.com/nirvana-picture.htm nirvana picture] [http://while.servemp3.com/resources/miniature-boxer.html miniature boxer] [http://while.servemp3.com/resources/used-nextel.html used nextel phone for sale] [http://bigger.servemp3.com/web/manufactured-home.html manufactured home dealer] [http://shrewd.servemp3.com/web/ual.htm ual] [http://incite.servemp3.com/q/chicks-with-dicks.html chicks with dicks] [http://weigh.servemp3.com/library/free-ecards.html free ecards] [http://jeshu.servemp3.com/rockport-boat.htm rockport boat shoes] [http://jeshu.servemp3.com/webcams.htm webcams] [http://bigger.servemp3.com/web/fog-lights.html fog lights] [http://shrewd.servemp3.com/web/claritin.htm claritin] [http://rumour.servemp3.com/blog/sexy-evening-dress.html sexy evening dress] [http://capdv.servemp3.com/farcry-mods.html farcry mods] [http://shrewd.servemp3.com/web/gaither-homecoming.htm gaither homecoming concert] [http://while.servemp3.com/resources/andersons-big-screen.html andersons big screen tv] [http://capdv.servemp3.com/homes-for-sale-by.html homes for sale by owner] [http://jeshu.servemp3.com/big-titts.htm big titts] [http://weigh.servemp3.com/library/porn-ebony-teens.html porn ebony teens] [http://incite.servemp3.com/q/orchard-bank.html orchard bank online payment] [http://while.servemp3.com/resources/sleigh-bed.html sleigh bed] [http://incite.servemp3.com/q/naked-men.html naked men] [http://rumour.servemp3.com/blog/tow-trucks.html tow trucks] [http://bigger.servemp3.com/web/old-woman-sex.html old woman sex] [http://rumour.servemp3.com/blog/her-first-lesbian.html her first lesbian sex] [http://rumour.servemp3.com/blog/mobilephone.html mobilephone] [http://jeshu.servemp3.com/hotel-reservations.htm hotel reservations] [http://weigh.servemp3.com/library/email-address.html email address] [http://bigger.servemp3.com/web/online-game.html online game]
{{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