Origin

From Valve Developer Community
Revision as of 11:33, 10 May 2008 by Beeswax (talk | contribs)
Jump to navigation Jump to search

In Source, we use the word Origin to refer to both the Reference Point at the center of a local coordinate system and as a convenient label for that system or Reference Frame itself.

In order to have interesting 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 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 brushes are part of the worldspawn entity, so their vertex coordinates are relative to the WorldOrigin.
  • EntityOrigin : (also called a placementOrigin) defines the Entity's Location and Orientation in the World as well as its (default) Center of Rotation, Emission, etc. Brush entities which require a local origin for their geometry use the Origin keyvalue
    Confirm:or the "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 Map Grid Coordinates for Location, and PYR (Pitch Yaw Roll) Angles for Orientation. Leaving Euler rotations for a very rainy day, a Normal Vector is another not uncommon way of expressing orientation.

Note.pngNote: 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 a local origin for a Model or Brush is not specified, it is assumed to be the geometric center of the Bounding box.
  • lightingorigin :see info_lighting entity and $illumposition QC command.
  • Center of Rotation : By default, an object's local Origin is used. Vphys objects rotate about their $masscenter.
  • Center of Emission (particles, gibs, etc)