- Home /
Question by
hari_sharan · Jun 24, 2016 at 10:49 PM ·
movementrandomrange
how can i move a platform/base in a x-z plane automatically within a given range
I just want to move my base automatically in random directions in x-z plane but within a given range can anyone help me with that?
Comment
Answer by Invertex · Jun 24, 2016 at 10:51 PM
You can utilize Mathf.Clamp() to limit the min and max values for each direction. And you can create a if/else conditional as well to prevent increasing or decreasing the value if it is greater than or lower than the specified min/max values you may have setup as a variable.
Your answer
![](https://koobas.hobune.stream/wayback/20220612083611im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Making enemies jump at random (c#) 2 Answers
How to stop MoveTowards teleporting 1 Answer
triggering random animations with gui 1 Answer
two Random.Range returning similar values 1 Answer
Missing a Method? Random.Range? 1 Answer