Hi,
I’m making a simple AI, witch should wander around changing it’s movement direction sometimes.
I tried using some functions, but they didn’t work realy good for me. I also tried random.rotation but then it starts rotating always and not only on y axis.
Can someone help me?
random.rotation returns a quaternion… you can change that into the eulerAngle representation and grab the y component from it. Then perform a rotation using that component and 0’s for x and z.
or you can just use random.range and Quaternion.Euler (Unity - Scripting API: Quaternion.Euler)
or you could use random.range in conjunction with AngleAxis (Unity - Scripting API: Quaternion.AngleAxis)
Thanks, this works perfect.