Working with axis orientation origin

From Valve Developer Community
Revision as of 21:19, 8 March 2009 by Thepaperdog (talk | contribs) (Updated)
Jump to navigation Jump to search

WORKING WITH ROTATION AND AXES

INTRODUCTION:

Most, if not all dynamic prop objects from the SDK Source can be rotated. In keeping with a three-dimensioned universe, prop objects can be rotated around all three axes: Pitch Yaw Roll (Y Z X).

A common difficulty with staging rotating objects in the map, is getting them to rotate (as we would naturally expect them to), no matter what their orientation and position on the map is.


ROTATION AROUND THE AXIS:

Rotation around the axis is measured as the movement of a line's angle (expressed as degrees) around a given origin. A line's angle can be incremented from 0 to 359 degrees (Or 1 to 360 degrees). Below is a brief description of the three axes.

  • Pitch (Y) - Forward/Backward rotation
  • Yaw (Z) - Directional (North, South, East, West) rotation
  • Roll (X) - Tilt (right,Left) rotation

WORKING WITH ROTATION AND ORIENTATION

The (Y Z X) Point of intersection (or vector) within a given prop, will describe (and is in fact, determined by) the physical attitude, orientation and (hand) of the prop, with respect to a given origin in the prop's universe. The following description will attempt to explain how attitude, orientation and hand of an object effects our perception of rotation around the axis.

Suppose you have a pen.

  • If you hold the pen vertically (upright) in front of you, the pitch orientation of the pen is 90 degrees (Y). Yet, While holding the pen, if you unscrew its cap, the rotation of the cap occurs (counter-clockwise direction) along the (Z) axis.
  • Take the same pen and hold it horizontally (on its side) in front of you. The cap now rotates (back, toward you) along the (Y) axis.
  • Finally, swivel the pen (while it is horizontal) so that you can only see the end of it in front of you. Now the cap rotates (left) along the (X) axis.

In each case, the axes changed, simply from re-orientation of the pen. This illustrates the impact of relative perspective. If the pen exercise had been conducted on the south edge of a circle, and another person observed the exercise from the west edge of the circle, the rotation along the (X) axis, as percieved from the south edge, would be a rotation along the (Y) axis, as percieved from the west edge, and so on.

In Valve's world, the absolute center of the universe is a fixed origin in the map. Therefore, an object's (X Y Z) settings might not appear at times to make sense from a relative perspective.


Perspective, using a Rotating Button

In the image example, The orientation of each of the buttons differs on each of the console panels. The Info start player is facing due north (0 degrees) in accordance with the map's absolute origin. The settings for each button are:

  • -45 0 0 For North
  • -45 -90 0 For East
  • -45 180 0 For South
  • -45 -270 0 For West

Some settings are expressed as negative values. It so happens that this prop model is represented by the back (south side) of the button. If we set the button's pitch (Y) to positive 45 degrees, the button would rest upside-down with 45 degree pitch up, exposing the front (north side) of the button, (and this might yield a 'no-draw fragment' effect on the image.)

Likewise, some of the (Z) settings are expressed as negative values; to ensure that the back-side of the button is properly exposed,

The X and Y Flags

Each of the button's property settings include the two axis flags:

  • X Axis Checked
  • Y Axis Checked