Forth Week
Project Introduction
This week's goal is to rebuild the rest of the Unity Virtual Camera's Body part. I successfully built 3 new following cameras including Framing Camera, Orbital Transposer and Transposer, and fixed the 3rd person camera's bug.
Fixing 3rd Person Bug
Last week, the 3rd person camera didn't rotate as the player rotate. I spent some time refactoring the code and rebuilding the logic to make it work. I figure out that if I calculate the target's forward vector, which should be normalized, and multiply it by the distance between the camera and the target, I can get the desired location and rotation I need.
Transposer Camera
Transposer camera is a camera that supports different binding modes, which can specify if the camera will rotate when the player's Yaw, Pitch, or Roll changes.
There's also a special binding mode called Simple Follow To World Up which emulates what a human camera would do when moving a camera. I implement this function by rotating the camera when the object moves and slowly moving if the distance between camera and object is bigger than the setting value. So right now it will only move when it is needed instead of constantly moving.
Framing Transposer
The Framing Transposer Camera supports the user-defined Dead zone and Soft Zone in the viewport, and the camera will only move when the object is out of the dead zone.
To make this function works, I make a function to set the zone, which will calculate the position of the border of the two zones. And after having the border, I move the object only when it is out of the dead zone, and move faster when it reached the border of the soft zone.
I was trying to figure out a way to show the zones in the viewport so the user can easily visualize the outcome, but I can't find a good way right now, will try to figure it out later.
Orbital Transposer
This Camera will create a circle around the target, when the player moves the mouse, the camera will rotate via the circle route. To make this function work, first I connect the actor to player input, so it can detect when the player moves the mouse. Then I bind the mouse x-axis input to a function that will change the angle as the player moves the mouse.
To calculate the desired location, I first get the target location and then subtract the cos and sin for the angle variable. Users can also change the Axis Range so the camera movement will clamp to the desired setting.
Obstacle
Framing Transposer couldn't find a way to visualize:
I haven't found a good way to bind the Widget with the target camera and show it in the viewport, need more research to finish this part.
Using lots of switch statement and if-else statement:
For this problem since there are so many functions I hope I can rebuild and learn, I will take a time to refactor the code(function node and event) after all the virtual camera's functions are done.
Estimating time problem:
I felt a little bit hard to estimate the correct time cost for every week. Even though I reschedule the timeline last week, this week I still didn't finish all the functions as I planned.
Next Week Plan
I will finish the last one of the target camera: the Tracked Dolly, the camera which will move along the specified route, which I will try to make by spline
I will start building the next part of the virtual camera - the aiming system
Aryna Ou