Hello everyone,
I’m currently developing a prototype where the player becomes bigger (the physical scale increases) after a certain event occurs. I’m using a third-person freelook camera, and I’ve also made it so that the height and radius of each rig become larger with the player, making a sort of “zoom out” effect. The problem is that this change happens instantly and not smoothly. This is what my code looks like:
// Update is called once per frame
void Update()
{
CalculateForward();
RotatePlayerToInput();
AdjustCameraDistance();
}
And this is the function responsible for scaling the heights and radii of each rig:
void AdjustCameraDistance() {
if (!radiusUpdated) {
for (int i = 0; i < 3; i++) {
// When the player gets bigger, multiply the heights and radii of the freelook cam.
// This will make a "zoom out" effect.
freelook.m_Orbits[i].m_Height *= cameraDistanceMultiplier;
freelook.m_Orbits[i].m_Radius *= cameraDistanceMultiplier;
}
radiusUpdated = true;
}
}
I tried using Mathf.Lerp when assigning the new height and radius values, but it didn’t have any effect. For example, freelook.m_Orbits[i].m_Height = Mathf.Lerp(freelook.m_Orbits[i].m_Height, freelook.m_Orbits[i].m_Height * cameraDistanceMultiplier, smoothTime * Time.deltaTime);
This didn’t do anything.
Do you guys have any ideas on how I can get this to work?