Working with axis orientation origin: Difference between revisions
Thepaperdog (talk | contribs) (Updated) |
Thepaperdog (talk | contribs) |
||
Line 16: | Line 16: | ||
==WORKING WITH ROTATION AND ORIENTATION== | ==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 ([http://en.wikipedia.org/wiki/Right-hand_rule 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. | 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 ([http://en.wikipedia.org/wiki/Right-hand_rule 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 (and prop manipulation) of rotation around the axis. | ||
Suppose you have a pen. | '''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). | * If you hold the pen vertically, (where the tip points upright) in front of you, the ''pitch orientation of the pen is 90 degrees (Y)''. 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. | * Take the same pen and hold it horizontally (so it lays flat on its side) in front of you. The ''pitch orientation of the pen is now 0 degrees (Y)''. The cap also 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. | * Finally, swivel the pen (while it is horizontal) so that you can only see the end of it in front of you. The pitch orientation of the pen is still 0 degrees (Y). But, now the cap rotates (left) along the (X) axis. | ||
---- | |||
'''Absolute vs Relative:''' | |||
In each case, rotation along the axes appeared to change, simply from re-orientation of the pen. The absolute (real value) orientation of the pen is dependant on an absolute '''origin''' somewhere in the universe. The proof is that; regardless of which axis a rotation occurs on, and no matter where you stand, if the pen lays down, the pitch orientation of the object is 0 degrees. Likewise, when the pen is raised straight up, its pitch is 90 degrees, and so on. | |||
---- | |||
'''Which Assessment is Correct''' | |||
Say you were floating in space, and you happend to turn upside down as you viewed the pen. In absolute terms, the pitch orientation of the pen is still 90 degrees. However, as far as you are concerned, the pen 's pitch appears to be -90 degrees. Which assessment is correct? (In Valve's world, you will always need to be aware of a map's absolute origin. You can trust, that the map's pitch level is always at 0 degrees). | |||
---- | |||
'''The Appearance of Rotation''' | |||
The appearance of Rotation along a given axis also depends on an absolute origin. However, the impact of ''relative'' perspective can be illustrated: | |||
*If the pen exercise had been conducted on the '''south''' edge of a circle, and another person had observed the exercise from the '''west''' edge of the circle, the pen-cap's rotation along the (X) axis, as percieved from the south, would appear as a rotation along the (Y) axis, as percieved from the west, and so on. | |||
==AN ILLUSTRATION OF RELATIVE PERSPECTIVE== | |||
Consider how all this might apply when attempting to position and orientate a ''button'' prop object in a map. | |||
In the image example: [[User:Thepaperdog/PgOrientation |Rotating Button]], the orientation of each button differs on each of the console panels. The info_start_player entity is facing due north (0 degrees) in accordance with the map's absolute origin. The '''Pitch Yaw Roll''' settings for each button are: | |||
*'''-45 0 0''' (North panel) | |||
*'''-45 -90 0''' (East Panel) | |||
*'''-45 180 0''' (South Panel) | |||
*'''-45 -270 0'''(West Panel) | |||
---- | ---- | ||
'''Use of negative values''' | |||
*Some settings are expressed as negative values. It so happens that this prop model's image represents only the back (south side) of a button and not its opposing north side. If we set this button's pitch (Y) to positive 45 degrees, the button would actually be resting upside-down on its back, with 45 degree pitch up, exposing the opposing north side of the button, (And this might yield a 'no-draw-fragment' effect in what the player sees.) | |||
*Likewise, some of the (Z) settings in the illustration are expressed as negative values. Our natural inclination is to set the button's (Z) value to 90 degrees (for East) and -270 degrees (for West). Again, the orientation of the button necessarily requires that its back-side be exposed for the proper effect. This means that its ''hand'' must be adjusted for negative values. (''or... you can use positive values, but they must be swapped, such that the ''East'' button is set to 270 and the ''west'' button is set to 90.'') | |||
*Keep in mind, that the ''position'' of the button (that is...which panel to place it in...) is not the primary concern here. It's the '''orientation''' of the button, which counts here. (So that it can then ultimately be positioned in the right context). | |||
==ORIGIN== | |||
'''Description''' | |||
Origin can be defined as a ''source'', from which all relevant values and references are derived. It also infers absolute '''center'''. Origin is expressed as '''(X Y Z)''' , representing '''Length''', '''Width''' and '''Height''', respectively. (Note: This is not to be confused with ''Pitch Yaw Roll (Y Z X)''). | |||
---- | |||
'''Grid Units and Scales''' | |||
In Valve, a map's origin is deemed the center of the map, and its values are: 0, 0, 0. From there, we can increment units of (X Y Z) on any scale that is suitable. For example, each unit on a grid can be made to represent 20 feet. Thus we can draw a texture brush and effectively build a block in our world, that is: | |||
*'''(4 units by 5 units by 2 units)''' or '''(80' long x 100' wide x 40' high)'''. | |||
The Hammer Editor allows developers to switch scales to feet, inches, etc. and increment those scales on the grid to qty per unit. | |||
Origin helps determine ambience in a map. For example, an env_sun can be placed west of the origin, along with a light_environment that points its light (from west to East) , effectively giving the player a sense that the time of day is approaching dusk. Like wise if the positions were reversed, it may seem like dawn. | |||
The assurence of 'absolute origin' in a valve map is evidenced by the fact that the player can never get to the ''other side'' of the sun and its light. Therefore there is never a doubt of the player's (or other objects') relative position to the origin. | |||
Revision as of 20:03, 10 March 2009
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 (and prop manipulation) of rotation around the axis.
Suppose you have a pen.
- If you hold the pen vertically, (where the tip points upright) in front of you, the pitch orientation of the pen is 90 degrees (Y). 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 (so it lays flat on its side) in front of you. The pitch orientation of the pen is now 0 degrees (Y). The cap also 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. The pitch orientation of the pen is still 0 degrees (Y). But, now the cap rotates (left) along the (X) axis.
Absolute vs Relative:
In each case, rotation along the axes appeared to change, simply from re-orientation of the pen. The absolute (real value) orientation of the pen is dependant on an absolute origin somewhere in the universe. The proof is that; regardless of which axis a rotation occurs on, and no matter where you stand, if the pen lays down, the pitch orientation of the object is 0 degrees. Likewise, when the pen is raised straight up, its pitch is 90 degrees, and so on.
Which Assessment is Correct
Say you were floating in space, and you happend to turn upside down as you viewed the pen. In absolute terms, the pitch orientation of the pen is still 90 degrees. However, as far as you are concerned, the pen 's pitch appears to be -90 degrees. Which assessment is correct? (In Valve's world, you will always need to be aware of a map's absolute origin. You can trust, that the map's pitch level is always at 0 degrees).
The Appearance of Rotation
The appearance of Rotation along a given axis also depends on an absolute origin. However, the impact of relative perspective can be illustrated:
- If the pen exercise had been conducted on the south edge of a circle, and another person had observed the exercise from the west edge of the circle, the pen-cap's rotation along the (X) axis, as percieved from the south, would appear as a rotation along the (Y) axis, as percieved from the west, and so on.
AN ILLUSTRATION OF RELATIVE PERSPECTIVE
Consider how all this might apply when attempting to position and orientate a button prop object in a map.
In the image example: Rotating Button, the orientation of each button differs on each of the console panels. The info_start_player entity is facing due north (0 degrees) in accordance with the map's absolute origin. The Pitch Yaw Roll settings for each button are:
- -45 0 0 (North panel)
- -45 -90 0 (East Panel)
- -45 180 0 (South Panel)
- -45 -270 0(West Panel)
Use of negative values
- Some settings are expressed as negative values. It so happens that this prop model's image represents only the back (south side) of a button and not its opposing north side. If we set this button's pitch (Y) to positive 45 degrees, the button would actually be resting upside-down on its back, with 45 degree pitch up, exposing the opposing north side of the button, (And this might yield a 'no-draw-fragment' effect in what the player sees.)
- Likewise, some of the (Z) settings in the illustration are expressed as negative values. Our natural inclination is to set the button's (Z) value to 90 degrees (for East) and -270 degrees (for West). Again, the orientation of the button necessarily requires that its back-side be exposed for the proper effect. This means that its hand must be adjusted for negative values. (or... you can use positive values, but they must be swapped, such that the East button is set to 270 and the west button is set to 90.)
- Keep in mind, that the position of the button (that is...which panel to place it in...) is not the primary concern here. It's the orientation of the button, which counts here. (So that it can then ultimately be positioned in the right context).
ORIGIN
Description
Origin can be defined as a source, from which all relevant values and references are derived. It also infers absolute center. Origin is expressed as (X Y Z) , representing Length, Width and Height, respectively. (Note: This is not to be confused with Pitch Yaw Roll (Y Z X)).
Grid Units and Scales
In Valve, a map's origin is deemed the center of the map, and its values are: 0, 0, 0. From there, we can increment units of (X Y Z) on any scale that is suitable. For example, each unit on a grid can be made to represent 20 feet. Thus we can draw a texture brush and effectively build a block in our world, that is:
- (4 units by 5 units by 2 units) or (80' long x 100' wide x 40' high).
The Hammer Editor allows developers to switch scales to feet, inches, etc. and increment those scales on the grid to qty per unit.
Origin helps determine ambience in a map. For example, an env_sun can be placed west of the origin, along with a light_environment that points its light (from west to East) , effectively giving the player a sense that the time of day is approaching dusk. Like wise if the positions were reversed, it may seem like dawn.
The assurence of 'absolute origin' in a valve map is evidenced by the fact that the player can never get to the other side of the sun and its light. Therefore there is never a doubt of the player's (or other objects') relative position to the origin.