Hi,
First of all, great course so far, thanks.
So I tried to add a if statement as follow to test that the scrollDelta is not 0:
private void HandleZoom()
{
float scrollY = Input.mouseScrollDelta.y;
if (scrollY != 0f)
{
Vector3 fromFollowOffset = cinemachineTransposer.m_FollowOffset;
float zoomAmount = 1f;
float zoomSpeed = 5f;
if (scrollY > 0f)
{
targetFollowOffset.y -= zoomAmount;
}
if (scrollY < 0f)
{
targetFollowOffset.y += zoomAmount;
}
targetFollowOffset.y = Mathf.Clamp(targetFollowOffset.y, MIN_FOLLOW_Y_OFFSET, MAX_FOLLOW_Y_OFFSET);
cinemachineTransposer.m_FollowOffset = Vector3.Lerp(fromFollowOffset, targetFollowOffset, Time.deltaTime * zoomSpeed);
}
}
I also tried to make the comparision with 0, 0f, 0.0f without any change…
But it break the nice smooth zoom somehow… I must be missing something.
If i remove the
if (scrollY != 0f)
it works perfectly…
Can u help me to undestand why please?