Local rotation without parent

Hi! I’ve got an interesting problem. I need to rotate object relative to its current rotation but without parent and do it with clamped angle. The main idea is something like that:

curZRot = Mathf.Lerp(curZRot, Input.GetAxisRaw("Horizontal") * zRotAng, Time.deltaTime * zRotSpeed);
transform.rotation = Quaternion.Euler(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z + curZRot);

But it depends on current rotation which changes every frame so object rotates continously.
For more understanding see picture below.
P.S Sorry for my English

Uploaded with ImageShack.us[/img]

To rotate around the local Z axis, you should use the transform’s localEulerAngles property instead of eulerAngles (which works in world space). The easiest way to clamp the banking angle is to treat angles greater than 180º as negative angles, which you do by subtracting 360 from them. Add the current rotation value each frame, but use Mathf.Clamp to keep the angle within the desired range:-

var rotRate: float;
var maxRotAngle: float;

function Update () {
	var rot = Input.GetAxis("Horizontal") * rotRate * Time.deltaTime;
	var currZ = transform.localEulerAngles.z;
	
	if (currZ > 180) {
		currZ -= 360;
	}
	
	transform.localEulerAngles.z = Mathf.Clamp(currZ - rot, -maxRotAngle, maxRotAngle);
}