I'm going mad to clamp rotation of an object.
I've tested using Inspector that correctly rotation range is Z>-15 and Z<30.
I've written this code but it isn't working properly !
if (rb.transform.rotation.eulerAngles.z > 30)
rb.transform.Rotate (-Vector3.forward * speedTurretMovement , Space.Self);
if (rb.transform.rotation.eulerAngles.z < -15 )
rb.transform.Rotate (Vector3.forward * speedTurretMovement , Space.Self);
Thanks
it isn't working properly
is a very poor bug description. What is it supposed to mean exactly? – realUser404 Mar 02 '17 at 15:26