I cropped out a bit of code to make this easier to read. Basically, I have a random variable (ourdir) which is either 1 or 2 and it determines if the cube’s X axis is rotated positively or negatively. The initial rotation is 90, 0, 180. I was using transform.rotate but it was giving me the same result, so that’s why I switched to this other rotation method. ourdir == 2 works fine, but ourdir == 1 has the cube kind of sitting in place. It jerks around a bit, but for some reason I’m unable to add to the X rotation of the model.
currotation = transform.eulerAngles.x;
anotherint = Random.Range(0.3f, 1.5f);
if (ourdir == 1)
{
currotation = currotation + anotherint;
transform.eulerAngles = new Vector3(currotation, 0, 180);
}
if (ourdir == 2)
{
currotation = currotation - anotherint;
transform.eulerAngles = new Vector3(currotation, 0, 180);
}