Source Mapping, Materials, Modeling and Code tutorials.
Main Custom Files All Downloads Search all TutorialsSearch all Tutorials
Hosted by GBC Game Design program
Check out more Source tutorials at City 7: Toronto Conflict
 

Printer Friendly




Every object in the game has an Origin.

A set of angles are also used to determine the objects orientation.
*An entity's orientation in the world.

These angles are X, Y and Z also known as Roll, Pitch and Yaw.

XY&Z are not only used to determine orientation but also angles of movement.

Roll Smile
Is most often a term used to describe rotation but as you know it has a wide use and is a term in Aeronautics to describe an Aircraft rotating on its X axis.

Pitch Smile
Is a term derived from the force of pitching an object, such as the way you would pitch hay. It has been used for a very long time to describe the way a ship at sea rocks Fore and Aft along the Y axis.
Most often it is used for the same effect on Aircraft.

Yaw Smile
Is a deviation or turning from side to side. Used in Yachting and Aeronautics it is an angle that can be used to calculate a coarse deviation along the Z axis.



In the image above you can see there are three sets of numbers representing the Pitch, Yaw and Roll for the direction of light from a light_environment entity.

Each of the 0’s can change from 0 to 360 degrees, in most cases 180 or less.

Since the first angle is for the Pitch we can point the light_environment straight down by changing those numbers to 90 0 0.
Straight up would be -90 0 0.

Most of the questions I get about Pitch Yaw and Roll have to do with the movement of doors and buttons.

To help illustrate how these angles work in your map I’ve created a sample project with 10 func_door entities.



These are the angles for each door and the direction in which they move.
1) -90 0 0, Up
1a) -90 0 0, Up
2) 90 0 0, Down
2a) 90 0 0, Down
3) 0 180 0, Left
3a) 0 180 0, Left
4) 0 0 0, Right
4a) 0 0 0, Right
5) 0 90 90, Left
6) 0 -90 -90, Right

The 10 doors in the sample project are all set to open and close every 3 seconds.
If you run the project and watch the doors you will see that doors 1 and 1a move exactly alike as do 2 and 2a, however doors 3 and 3a plus doors 4 and 4a do not move exactly alike even though they are exact copies of each other.

This is because I rotated each of the backside doors, 1a, 2a, 3a and 4a.

Since doors 1 and 2 are moving up and down rotating them did not affect the copies 1a and 2a.

However since the copies of 3 and 4 have changed we need to adjust the Pitch Yaw and Roll to make them move properly.

The doors 5 and 6 are copies of 3 and 4 but with the correct movement.

As you can see to make door 5 move properly we had to change 0 180 0 to 0 90 90.

There’s a lot more you can do, I hope I’ve stimulated your imagination.Smile

  DownloadThe example used in this tutorial.





Valve, the Valve logo, Half-Life, the Half-Life logo, and the Lambda logo are trademarks and/or registered trademarks of Valve Corporation Site.