Coordinates: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(merge Origin in)
Line 1: Line 1:
<div style="float:right;padding:1em;background:white;">[[Image:Coordinates.png|A two-dimensional coordinate system]]</div>
<div style="float:right;padding:1em;background:white;">[[Image:Coordinates.png|A two-dimensional coordinate system]]</div>


'''Coordinates''' are used to store locations. They are represented as groups of numbers, one per dimension, which taken together can be used to find a location on a grid (or, less commonly, a line). Each value is relative to the current [[origin]].
'''Coordinates''' are used to store locations. They are represented as groups of numbers, one per dimension, which taken together can be used to find a location on a grid (or, less commonly, a line). Each value is relative to the origin (see below) of the current object.


Coordinates in Source are <code>(<span style="color:red;font-weight:bold;">X</span>,<span style="color:green;font-weight:bold;">Y</span>,<span style="color:blue;font-weight:bold;">Z</span>)</code>, where X is right, Y is forward, and Z is up. <code>(0,0,1)</code>, for example, is a point one [[unit]] directly above the origin.
Coordinates in Source are <code>(<span style="color:red;font-weight:bold;">X</span>,<span style="color:green;font-weight:bold;">Y</span>,<span style="color:blue;font-weight:bold;">Z</span>)</code>, where X is right, Y is forward, and Z is up. <code>(0,0,1)</code> is a point one [[unit]] directly above the origin.


Coordinates are often stored alongside a set of rotation [[angle]]s.
Coordinates are often stored alongside a set of rotation [[angle]]s.


{{tip|SDK tools generally align coordinates so that the camera is looking down the -Y axis, since this tends to have the effect of making the item in question face you. Remember that this makes X appear reversed.}}
{{note|'Global coordinates' refer to the coordinates of the [[world]]. All other coordinate systems are 'local coordinates' of an [[entity]].}}


{{tip|'Global coordinates' refer to the coordinates of the [[world]]. All other coordinate systems are 'local coordinates' of an entity.}}
{{tip|SDK tools generally align coordinates so that the camera is looking down Y, since this tends to have the effect of making the item in question face you. Remember that this makes X appear reversed.}}
 
== Origin ==
 
The '''origin''' of an object is the point at which its local coordinates are <code>(0,0,0)</code>. This is the 'centre' from which all other local coordinate values are relative.
 
{{tip|There can be multiple origins within the same entity: its own origin, the origin of its model, etc. Each origin defines its own local coordinate system relative to its parent.}}


== See also ==
== See also ==


* [[Origin]]
* [[Wikipedia:Coordinate system]]
* [[Wikipedia:Coordinate system]]
* [[$origin]] and [[$autocenter]] (for [[model]]s)


[[Category:Glossary]]
[[Category:Glossary]]

Revision as of 17:12, 16 January 2009

A two-dimensional coordinate system

Coordinates are used to store locations. They are represented as groups of numbers, one per dimension, which taken together can be used to find a location on a grid (or, less commonly, a line). Each value is relative to the origin (see below) of the current object.

Coordinates in Source are (X,Y,Z), where X is right, Y is forward, and Z is up. (0,0,1) is a point one unit directly above the origin.

Coordinates are often stored alongside a set of rotation angles.

Note.pngNote:'Global coordinates' refer to the coordinates of the world. All other coordinate systems are 'local coordinates' of an entity.
Tip.pngTip:SDK tools generally align coordinates so that the camera is looking down Y, since this tends to have the effect of making the item in question face you. Remember that this makes X appear reversed.

Origin

The origin of an object is the point at which its local coordinates are (0,0,0). This is the 'centre' from which all other local coordinate values are relative.

Tip.pngTip:There can be multiple origins within the same entity: its own origin, the origin of its model, etc. Each origin defines its own local coordinate system relative to its parent.

See also