Origin: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (avoid redirect)
(made redir)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
In Source, we use the word '''Origin''' to refer to both the ''Reference Point'' at the center of a  [http://en.wikipedia.org/wiki/Coordinates_%28mathematics%29 local coordinate system] ''and'' as a convenient label for that system or ''Reference Frame'' itself. <!--So "WorldOrigin" is used to refer to the World coordinate system (XYZ axes) and the origin in that system (0,0,0).-->
#redirect [[Coordinates]]
 
In order to have interesting [http://en.wikipedia.org/wiki/Rigid_body interactions between solid objects] in game, Source uses a simple ''Hierarchy of Reference Frames''. At the top of the hierarchy is the '''WorldOrigin'''. A Point Entity's '''Position''' is its Location ''and'' Orientation <!--(yes, both!)--> in the World, ie its ''linear and rotational offsets'' relative to the ''WorldOrigin''. The Entity's own geometry (eg its [[angles]]) are relative to its '''EntityOrigin'''. The Entity's Position and Origin are in exactly the same point in space; and are almost the same thing. The only difference is which ''Frame of Reference'' you are looking at it from. When describing any geometric properties - vertices, angles, etc - it's very important to be clear which ''Frame of Reference'' we're referring to.
 
* '''WorldOrigin''' : (also called the ''map origin'') is actually the [[worldspawn]] entity's position in the World (0,0,0). All [[World brush]]es are part of the [[worldspawn]] entity, so their vertex coordinates are relative to the ''WorldOrigin''.
 
* '''EntityOrigin''' : (also called a ''placementOrigin'' or ''pathOrigin'') defines the Entity's current Location (XYZ) and Orientation (PYR) in the World.
 
* '''ModelOrigin''' : is usually aligned to the ''EntityOrigin''. [[Studiomodel]] geometry has its own reference [[$origin]] (see [[$autocenter]], [[$illumposition]], [[$masscenter]] ). [[Brush entities]] may offset their ''pathOrigin'' (EntityOrigin) from their vertex geometry (ModelOrigin) using the [[Template:KV Origin|Origin keyvalue]] {{confirm|or the [[Tool_textures|"origin" tooltexture]]}}.
 
* '''BoneOrigin''' : (also called the [[parentbone]]) Each Studiomodel [[Bone]] is a reference point for the model's Attachments points, Vertex geometry, Animations, Joints, etc. Each bone is ultimately connected to the ''ModelOrigin'' via the [[Skeleton]] or ''bonetree hierarchy''.
 
==Position data==
An object's '''Position''' is the Location and Orientation of its Origin relative to its ''local'' (ie its Reference Frame's) Origin and Axes.
 
Ultimately all point-positions are translated up through the hierarchy into a location and orientation relative to the WorldOrigin. However, each Reference Frame may use a different mathematical method for recording a given Position. Often the Location and Orientation values are handled separately. The most familiar will probably be the WorldOrigin's ''XYZ [[Dimensions| Map Grid]] Coordinates'' for Location, and ''PYR (Pitch Yaw Roll) [[Angles]]'' for Orientation. Leaving [http://en.wikipedia.org/wiki/Euler_angles Euler rotations] for a very rainy day, a [http://en.wikipedia.org/wiki/Surface_normal Normal Vector] is another not uncommon way of expressing orientation.
 
{{note| an object's ''Origin <coordinates>'' really means its ''Location''; by definition an origin's coordinates are 0, 0, 0).}}
 
==Use of local origins==
* Generally, if the ModelOrigin (of a Model or Brush) is not specified, it is assumed to be the geometric center of the [[Bounding box]].
 
* '''Lighting Origin''' :see [[info_lighting]] entity and [[$illumposition]] QC command.
 
* '''Center of Rotation''' : An object's vertex geometry only rotates about its Center of Mass ([[$masscenter]]) which is usually aligned to its ModelOrigin. This should not be confused with its '''Center of Orbit''', which defines the center of a circular movement path, not an axis of rotation. An object may - at the same time - rotate (its [[angles]]) and orbit about different origins, at different speeds and even in different directions.
 
* '''Movement Path''' : usually the ModelOrigin is aligned to the EntityOrigin. If it is offset, the ModelOrigin (ie the model or brush) will move parallel to the EntityOrigin's path (eg [[func_movelinear]]), and/or ''orbit'' the EntityOrigin when it rotates (eg [[func_rotating]]).
 
* '''Center of Emission''' (particles, gibs, etc)
 
<!--
// eg leech.mdl - (animated) model swims around EntityOrigin ...
// eg func_rotating - brush hinges/orbits around EntityOrigin (specified by kv)
-->
 
 
<!-- // needs work!
* Attachments and Joints ... a bone is linked to its parentbone via a joint. The joint properties (angles etc) are defined by the bone, not the parent. The child ''attaches'' to the parent. By contrast, an attachment point is part of the parent's skeleton, and when it ''attaches'' to an object, the attachment point defines the joint properties (angles, etc). This is why w_weapons are rigged with $bonemerge rather than attached ... ?
-->
 
[[category:Glossary]]

Latest revision as of 17:12, 16 January 2009

Redirect to: