I have a player object that gather’s power-ups that grows in size.
I used a public int called dnaCounter.
I then have a camera script attached to my main camera that follow’s my player character around and that’s in the player object. I access the player object to get the counter.
Simply, I increased the orthograhpicSize by taking note of the counter but the zoom feels off, and it is not smooth.
private void FixedUpdate()
{
size = player.GetComponent<CharacterController2D_4D>().dnaCounter;
if ( size >= 7 )
{
size = 7;
}
GetComponent<UnityEngine.Camera>().orthographicSize = ((Screen.height / (8 - size)) / cameraDistance);
}
I have found similar solutions that use Mathf.lerp to smooth it out, but I’m unfamilar with how this to incorporate this into my current solution.
Any suggestions?