Tested and Works
CSharp
<code>
private float ZoomAmount = 0; //With Positive and negative values
private float MaxToClamp = 10;
private float ROTSpeed = 10;
void Update(){
ZoomAmount += Input.GetAxis(“Mouse ScrollWheel”);
ZoomAmount = Mathf.Clamp(ZoomAmount, -MaxToClamp, MaxToClamp);
var translate = Mathf.Min(Mathf.Abs(Input.GetAxis(“Mouse ScrollWheel”)), MaxToClamp – Mathf.Abs(ZoomAmount));
gameObject.transform.Translate(0,0,translate * ROTSpeed * Mathf.Sign(Input.GetAxis(“Mouse ScrollWheel”)));
}
</code>
Javascript
<code>
var ZoomAmount : float = 0; //With Positive and negative values
var MaxToClamp : float = 10;
var ROTSpeed : float = 10;
function Update() {
ZoomAmount += Input.GetAxis(“Mouse ScrollWheel”);
ZoomAmount = Mathf.Clamp(ZoomAmount, –MaxToClamp, MaxToClamp);
var translate = Mathf.Min(Mathf.Abs(Input.GetAxis(“Mouse ScrollWheel”)), MaxToClamp – Mathf.Abs(ZoomAmount));
gameObject.transform.Translate(0,0,translate * ROTSpeed * Mathf.Sign(Input.GetAxis(“Mouse ScrollWheel”)));
}
</code>