16
Support / Re: Achieving a smooth, lerped zoom effect
« on: September 29, 2014, 06:13:51 am »
Upon closer inspection, it looks like the problem is what I originally thought it was-- the camera doesn't appear to recognize small changes in ZoomFactor.
To give an example of what I'm talking about-- if I set the ZoomFactor to 1 and run this code:
void Update () {
if (Input.GetMouseButtonDown (0)) {
myCamera.ZoomFactor += 0.001f;
}
}
.. Clicking the mouse once produces no visible change to the camera. However, if I click the mouse 6 times so that ZoomFactor is 1.006, a very obvious visual change occurs on that 6th click. This would explain why the small changes toward the end of my Lerp don't always register in the camera.
Is this just a limitation of how ZoomFactor functions? If so I can work around it, but it seems like there may not be a way to get the exact effect I'm looking for.
To give an example of what I'm talking about-- if I set the ZoomFactor to 1 and run this code:
void Update () {
if (Input.GetMouseButtonDown (0)) {
myCamera.ZoomFactor += 0.001f;
}
}
.. Clicking the mouse once produces no visible change to the camera. However, if I click the mouse 6 times so that ZoomFactor is 1.006, a very obvious visual change occurs on that 6th click. This would explain why the small changes toward the end of my Lerp don't always register in the camera.
Is this just a limitation of how ZoomFactor functions? If so I can work around it, but it seems like there may not be a way to get the exact effect I'm looking for.