Quantcast
Channel: Answers by "Graham-Dunnett"
Viewing all articles
Browse latest Browse all 959

Answer by Graham Dunnett

$
0
0
`Mathf.Clamp` is documented as taking three values. The second is the min value and the third is the max value. Each time you use this API you have the min and max values reversed. I think we can all agree here that 330 is bigger than 30. I suspect what you really want is the angle to vary between -30 and +30. (Otherwise I think you'd say you want to limit between 30 and 330.) So you'd want to precondition the angle to be in the range -180..180 prior to calling `Clamp(angle, -30.0f, 30.0f)`.

Viewing all articles
Browse latest Browse all 959

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>