0

I am developing some logic and realized that clamp function not clamping rotation properly. It is always returning max rotation that I have put in the limit.

Then i made another simple logic to check what is wrong. I came to know that the, Clamp function returning max limit and min limit automatically. I have Input.GetAxis("Ver") placed in the code so value must be zero when no input from axis. But clamp is returning max value it doesn't make sense.

May be my understanding to Mathf.Clamp() is wrong. Therefor I am posting my code with it. Code That I Have Written

Output in the console window

Note: I am not pressing any button associated with axis input. Axis input is zero. And I am using unity 3d 5.6 personal edition.

Bilal Mirza
  • 233
  • 1
  • 3
  • 14

1 Answers1

2

Your arguments are in the wrong order, the correct order is number, min, max. Mathf.Clamp Documentation

FINDarkside
  • 2,102
  • 1
  • 18
  • 26