Handling the camera (written by: Zodiac )

This tutorial is about using the Camera instruction  in events.

All the camera values are absolute; not relative. It will only take into acound current values to determine the shortest way to reach destination.
Absolute: Based on point zero (0,0,0)
Relative: Based on last coordinates

All numbers are suggestions and by no means you must use only those. Anything can range from -32768 to 32767.
For the sake of simplicity, all words don't have their bytes swapped to avoid confusion when hex editing.

Go take a look at the maps sections to help yourself when you want to determine coordinates or the like. By the way those maps were all taken at 30º; except the first one at 90º.

### 1- Move on X axis

A tile is 28x28
The camera can move 4x more precisely than the tiles, so moving a tile away would require 28*4=112.
If you simply add tiles, it will already be centered, 112 will have 1st tile centered. 168 whoever will be the border between 1st and 2nd tiles.
00112(x7000) = 20 pixels = 1 tile (center)
00392(x0001) = 98 pixels = 3,5 tiles (border 3-4)
00896(x8003) = 224 pixels = 8 tiles (center)

### 2- Move on Z axis

Similarly to the X & Y, 1h is 12 pixels high, or 48 units high when using the camera.
Centering is the determined by given height +2h (48*2=96), which is technically not correct as most units are 3h high (48*3=144) so if you want "perfect" centering, you have to subtract 1/2h (40/2=24).
00048(x3000) = 1h (centers 3h)
00192(xC000) = 4h (centers 6h)
00384(x8001) = 8h (centers 10h)

### 3- Move on Y axis

see Move on X axis

### 4- Angle *From the map's base

00000(x0000) = 00,00º
00302(x2E01) = 26,54º (often used in instructions)
00341(x5501) = 30,33º
01024(x0004) = 90,00º (bird view)

### 5- Rotation around the map *clockwise

The camera will take the shortest way to the new coordinates based on the previous ones.
You should always stay in a range on -180º to 180º to avoid unecessary rotations. I marked -135º, -45º, 0º, 45º and 135º with an asterix (*) to help.
-03584(x00F2) = -315,00º [Map_1]
-02560(x00F6) = -225,00º [Map_2]
-01536(x00FA) = -135,00º [Map_3]*
-00512(x00FE) = -045,00º [Map_4]*
00000(x0000) = 000,00º [Map_0]* ((0,0) at bottom left corner)
+00512(x0002) = +045,00º [Map_1]*
+01536(x0006) = +135,00º [Map_2]*
+02560(x000A) = +225,00º [Map_3]
+03584(x000E) = +315,00º [Map_4]

### 6- Camera Rotation *clockwise

And no, at 180º your characters won't fall from the map like ants. That's why it's the camera that is rotating, and not the map.

-02048(x00FA) = -180,00º
-01024(x00FB) = -090,00º
-00512(x00FE) = -045,00º
00000(x0000) = 000,00º
+00512(x0002) = +045,00º
+01024(x0004) = +090,00º
+02048(x0008) = +180,00º

### 7- Zoom level

This one is rarely ever used since resizing makes the maps, and mostly units, ugly.
02048(x0008) = 050%
04096(x0010) = 100%
08192(x0020) = 200%

### 8- Time Required

00050(x3200) = 0,50 seconds
00100(x6400) = 1,00 second
00300(x2C01) = 3,00 seconds

So let's take the event where Besrodio is caugh.

 Camera (+00392, +00115, +00504, +00302, +00512, +00000, +04096, +00070);
[...]
 DisplayMessage ("
{font:08}Rudvich Mercenary
{font:00}I know you're in there!
Open the door!!
");
[E5] WaitForInstruction (r0100);
 CloseDialog (r02FFFF0000);
[E5] WaitForInstruction (r0100);
 Camera (+00056, -00172, +00680, +00190, +00336, +00000, +08192, +00016);
[E5] WaitForInstruction (r0400);
[F1] Wait (00006);
 PlaySound (x0018);
 Earthquake (r02020001);

I will directly add the +2 height in my calculations.
So basically the camera starts at (3.5, 1.026, 12.5), 26.54º angle, 45º/-315º [Map_4], 0º rotation, 100% zoom and camera has already moved so time is not important.
and it ends up at (0.5, -1.536, 16.167), 16.7º angle, 29.53º/-330.47º, 0º rotation, 200% zoom all that during 1.6 seconds

Let's now see what the camera will actually do
0.5 - 3.5 = Move -3x
- 1.536 - 1.026 = Move -2.562y
16.167 - 12.5 = Move 3.667z
16.7º - 26.54º = lower angle by 9.84º
29.53º - 45º = rotate around by 15.47º anti-clockwise
0º - 0º = no change
200% - 100% = +100% zoom increase
All that will be done during 1.6 seconds. Everything will start at the same time and end at the same time.

That is all.
Final Fantasy Hacktics 2.0 ~ The Final Fantasy Tactics Hacking community