I’ve just started unity and I made a basic 2D game that I then converted to 3D, using the same code just reskinning some things, doing this, despite using the same code, my random.range spawned objects in the 120-degree area I had it working for, but in 3D this seems to be anywhere on the 360 degrees area.
As far as I’m aware there are no other cases of this happening I can find online.
The number generator:
void RotRange (float startRot, float endRot){
Vector3 rotation = transform.eulerAngles;
rotation.z = Mathf.Clamp (Random.Range (startRot,endRot), startRot, endRot);
print (rotation.z + " , " + pattenNum);
//print (rotation.z);
transform.eulerAngles = rotation;
}
(startRot is 0f, endRot is 120f)
But even when I use mathf.clamp the values are still on a 360 spectrum and not been confined so i think there must be some external factor, I’m not sure if anyone knows what might cause this, and there is pretty limited information to go on but thank you in advance