rotate back to resting when not fireing

Hi im working on adding some recoil to a gun that im messing around with. im currently doing this whenever i fire a bullet

transform.localRotation = Quaternion.Lerp(transform.localRotation, new Quaternion(RecoilRotationX,0,0,0), rotateSpeed * Time.deltaTime);

and what happens is it sticks where it was instead of lerping back down to 0,0,0,0 which i would want it to do like this

transform.localPosition = Vector3.Lerp(transform.localPosition,RecoilPosition, lerpTime * Time.deltaTime);

that rotates back when its done but the rotation does not how can you rotate back to 0,0,0,0 when im not firing?


Quaternions are complex mathematical objects that involve complex math which most of us will not understand. Instead of spending hours of your time trying to understand them, simply use this to create them:

Quaternion quat = Quaternion.Euler(xAngle, yAngle, zAngle);

For more info on Quaternion.Euler check out this link: