• Kara Laumann

2D Camera Controller

On my Student Team Project, I am in charge of all things Game Feel. In Unity3D I created simple Player and Camera Controllers. This Camera Controller is in its early stages and will be worked on throughout the project. As you can see in the below videos, the Camera follows the player with a slight drag to make it feel realistic. When developing this Camera Controller, I wanted to make sure it didn't keep the player always in the center. Often Cameras like that always feel fake and lack the fluidity that can be created with a slight drag. The Camera also has a slight offset to be higher and in front of the player depending on which direction they are facing. This allows the player to better see in front of them which is generally where things are happening. I created the Camera to swap its offset depending on the player's direction, so that if the levels have the player moving different directions they can always see ahead of them. The Camera also slowly lerps to each side for a smoother transition. The speed of the lerping still needs to be adjusted when we implement the character art and levels.

This project has a Wind mechanic which adds force to the player in whichever direction the wind is heading. This presented a problem with the Camera. The player is moving so fast that the Camera, with the original script, can't keep up. The drag is now making it hard to keep the player in view. I attempted to increase the speed of the Camera whenever the player is being affected by wind, but that created its own problem of making the Camera change its offset in the X too fast. This persisted as a problem, so to make the Camera keep it's lerp and follow at the same speed I added a Rigidbody2D to it and applied the same upwards force to it. To allow it still feel like the player was moving upwards I decreased the force a little bit letting it follow behind the player as the wind is affecting them.

Camera Controller Without Force

Camera Controller With Force

  • LinkedIn - Black Circle
  • Twitter - Black Circle