This is my Aim Down Sights code, and i want when i ads my recoil divide by 3.
But it divide by 3 every frame until it reach 0.
what i want is:
if recoil is 9 it stay 3 on button fire2 pressed
the AdsController function is called on Update
someone can help?
void AdsController() {
Vector3 adsRecoilKickBack = currentWeapon.recoilKickBack / 3;
Vector3 adsRecoilRotation = currentWeapon.recoilRotation / 3;
if(Input.GetButton("Fire2")) {
isAiming = true;
AdsAnimHolder.transform.localPosition = Vector3.Lerp (AdsAnimHolder.transform.localPosition, currentWeapon.currentSight.adsPos, 0.25f);
currentWeapon.recoilKickBack = adsRecoilKickBack;
currentWeapon.recoilRotation = adsRecoilRotation;
}
else {
isAiming = false;
AdsAnimHolder.transform.localPosition = Vector3.Lerp (AdsAnimHolder.transform.localPosition, Vector3.zero, 0.25f);
}
}