Eighth Week
Project Introduction
This week's goal is to reproduce the Cinemachine Brain in Unreal. I researched Cinemachine and made the two functions of Cinemachine Brain. One is Priority Properties which decides which Camera will be in the viewport. The other one is the custom blend of Cinemacine brain.
Cinemachine Brain
First of all, I need to create a Cinemachine brain. In Unity, the brain is a component script under the Main Camera. I tried to implement it by creating it as Actor Component, but then I figure out it's not convenient for the user to use if they always need to assign it under an actor. So I made the Cinemachine Brain as an Actor.
The Cinemachne Brain will store the first player controller so that it can change the viewport camera from it. With this, there's no need for the Level blueprint to assign the viewport anymore.
Priority Properties
This Property can be assigned to every Virtual Camera, The virtual camera with the highest priority will be the one in the viewport. I implement it in a really simple way which will loop through all the virtual cameras in the scene and find the highest priority one.
Next week, I want to sort all the cameras by priority and make a NextCamera function in which the viewport camera will change to the next highest priority camera.
Custom Blend
The custom blend supports the user to assign a list of cameras they want to be in the viewport and how to blend to the next camera.
To implement this function, I made a struct with all the information needed from the user which includes, the From and To camera, the Blend Style, and the time the camera takes lead. And in the Tick function, it will check if the time is reached, and blend into different cameras.
The User can assign the Loop boolean to decide if it should loop after it reached the last one.
Easily Use
I implement a function that can be called in the blueprint so the user can call this function to change the viewport.
Research
Besides the normal use case, Unity also have some different variant cameras:
""State-Driven Camera"" which will change as the target animation state change.
""Free-Look Camera"" will calculate 3 circles around the target, the camera will move as the mouse axis change. It's useful in car racing games in which the player can move the viewport around their car.
""The Clear Shot Camera"" will have a list of cameras and check if there's anything between the current camera and the target. If there is, it will arrange to one without any collision.
Obstacle
Unity Cinemachine has lots of functions, but all the function is quite scattered. For example, the cameras I mentioned above will be added separately from the normal virtual camera. It takes time to gather all the information of it. And knows what I can reproduce in Unreal.
Unreal and unity have different logic, so I'm trying to implement it in a way that is easier for the unreal user to use. It involves lots of design choices, especially after I started the Cinemachine brain.
This week I did a poor time arrangement, I didn't do as much as I planned. I hope that next week put more hours in PPP.
Next Week Plan
First of all, I hope to change the priority camera logic so that I can make a function to change the camera among the priority. This will involve some algorithms, and I hope I can implement my own sorted logic. I will also start to implement Free-Look Camera. And research if the state-driven camera is possible to implement in Unreal.
Aryna Ou