Log On

Tutorial: Yaw/Pitch/Roll
Page 2

Read Previous


The command /debugsun will report a pitch and yaw into the console. Simply utilized it can be input directly into the flare's key's and used as a 'WYSIWYG' flare pointer, and calculated to position the sun within a shader. But there's more that can be done with it if you choose to do so.

An  important point is it shows the player's pitch and yaw, not their 'model' pitch and yaw  which is where most of the confusion starts. Lets take a quick-and-dirty (and not precise but good enough) picture example here:

The red line is the pitch/yaw of 78/-65, which is directly looking at a q3map_sun source of degrees:65 angle:78 (previous page), and the flare with the key: value of yaw:78,pitch:-65 respectively. The green line shows the normalized yaw. The red line is also the trajectory which shoots from the player's origin +90 degrees to the player's model pitch and yaw, the blue line.

Ok, now what does that mean?

Again, the radiant image. N/S is Y, E/W is X.

And a  visual example of Pitch, Yaw, and Roll angles in 3 dimensions.

Lets split it into parts. Take an example of a player rolling along the Z axis, spinning in a circle.

From the picture above, you can see that North is 90, East is 0, South is -90, and W is 180.

Now lets consider a player looking up and down. This is also a picture of a direct centerview hit for reference.

From the picture above, you can see that a pitch of -90 is directly up, 90 is directly down, and that 180 is flipped. (There is no transition for complete pitch rotation coded into quake3 for the viewer, min's and max's are approximately -90 and 90. The "roll" along the Y axis is locked in player and model movement to keep players from getting motion sickness or getting disoriented, unlike the game 'Decent').

Ok, so now how do you take this information and transition it to a q3map_sun parm? If you notice, it's ass backwards, right?

We have to define min's and max's. We know, for instance, that the elevation is related to the pitch, except it's negated (*-1). So with the q3map sun elevation of 78, the pitch is -78 for the flare.

Now for the yaw. The degrees in q3map allow for a full 360 definition in either negative or positive territory. But, a variable for a yaw will only go up to 180, and get there from two different directions! With the hellsky example above, its directly correlated. So what happens then if the degrees is greater then 180? Well, you simply subtract it from 360, and *-1.

How can you use this for the sun? If you have a yaw of a negative number, you can simply add that to 360. Say you get a yaw of -60. Q3map_sun degrees would be -60+360= 300, and a pitch of -46 would be a elevation of 46.

Next: The pitch/yaw/roll of misc and func_rotating entities.