Ninth Week
Project Introduction
This week's goal is to build the free-look camera and sort all the cameras by their priority and implemented the sorted algorithm by my functions.
Sorting Cameras
I didn't try to use the default sorting function for 2 reasons: first, I'm not sure if they can support sorting the Tarray of the class by one of the member properties. Second, I hope I can learn more about sorting algorithms. I chose quick-sort to sort my cameras. While implementing it, I encountered problems that the default swap of Tarray couldn't swap the pointers. So I manually swap by myself.
Free-Look Camera
Free-Look Camera is a camera similar to the Orbital camera but contains 2 more circles around the target. As the player moves the mouse X-Axis, the camera will move from these 3 circles. It's useful for some car racing games where players can see different angles of the target.
The user only needs to change the height and radius of all circles, then it can work accordingly.
Hierarchy
Since Free-Look Camera is a different camera from the Virtual Camera, to implement this Camera, I need to also implement the hierarchy of all the variance of cameras for the priority functions. I made a Base Camera and all the Cameras will inherit from it. The Base Camera contains the priority property, so when I sort, it only needs to know the base camera.
Obstacle
Unreal's C++ is quite different from standard C++. Sometimes, a function which is work in C++ does not work in Unreal C++. For example, when I working on the sorting function, it takes me a long time to figure out which way can swap the object pointers as I wished.
Next Week Plan
Next week, I planned to implement the clear shot camera which will smart choose the best camera without anything blocking the target. The other thing I want to do is to make this system easier for the user to use, so I'm going to implement some useful functions which could be called in blueprint or C++.
Aryna Ou