PDA

View Full Version : [K1] Rotating Characters in the GIT File

e-varmint
12-22-2007, 02:17 PM
The .git file uses an annoying vector system for determining the rotation of a character. The values are entered in the XOrientation and YOrientation fields in the Creature List structure. I have not seen any tutorials on this, so I thought I would post the information I have.

OK, imagine that your character is standing in the center of a giant peice of graph paper at the intersection of the X and Y axes. This is the 0,0 coordinate. By default, the character is facing due North. The y axis runs N-S, the x axis runs E-W. North and East are positive values, South and West are negative values. In order to determine the direction that your character is going to face, you have to draw a line from the 0,0 coordinate to an x,y coordinate. If your x,y=1,1 the line would run NE at a 45 degree angle. We'll call this 45E, since it would rotate the character 45 degrees to the East. If you want your character rotated 45 degrees to the West, your line would go from 0,0 to -1,1. In other words, you would have determined the angle by going 1 gridline to the West (-1), and 1 gridline to the North (1). In the .git file, you would enter -1 in the XOrientation field, and 1 in the YOrientation field.

My math skills are not good enough to come up with a formula to convert angles to vectors, so I got some graph paper and a protractor and came up with this:

0 (due N)= 0,1
30E=4,7
45E=1,1
60E=7,4
90E=1,0
120E=7,-4
135E=1,-1
150E=4,-7
180 (DUE s)= 0,-1

30w= -4,7
45w= -1,1
60W= -7,4
90W= -1,0
120W= -7,-4
135W= -1,-1
150W= -4,-7

So, if you want your character facing 30 Degrees to the NorthEast, you would enter 4 as the X and 7 as the Y orientations.

North is "up" on the mini-map in most of the modules, and most characters face North when you enter a 0,1. One module (I forget which) is rotated so that E or W is "up", and some characters, such as Zax, are 90 degrees off.

Hopefully, someone who has an easier way of dealing with the vector system will read this and post their wisdom.

Edit: This does not work with doors, which use a different type of unit in a field called Bearing.

The "bearing" measurements for doors in the .git file use radians instead of degrees.

15= 0.261799388
30= 0.523598776
45= 0.785398163
60= 1.047197551
75= 1.308996939
90= 1.570796327
105= 1.832595715
120= 2.094395102
135= 2.35619449
150= 2.617993878
165= 2.879793266
180= 3.141592654
195= 3.403392041
210= 3.665191429
225= 3.926990817
240= 4.188790205
255= 4.450589593
270= 4.71238898
285= 4.974188368
300= 5.235987756
315= 5.497787144
330= 5.759586532
345= 6.021385919