private void ApplyVelocityAndDampening(GunSettings.FirstPersonRecoilSettings recoil, ref Vector3 offset, ref Vector3 velocity) { offset += velocity * Time.deltaTime; offset = Vector3.Lerp(offset, Vector2.zero, Time.deltaTime * recoil.OffsetDamper); velocity = Vector3.Lerp(velocity, Vector2.zero, Time.deltaTime * recoil.VelocityDamper); }
private static Vector3 CalculateNewVelocity(GunSettings.FirstPersonRecoilSettings recoil) { var xOffset = Random.Range(recoil.MinXVariance, recoil.MaxXVariance); var yOffset = Random.Range(recoil.MinYVariance, recoil.MaxYVariance); var zOffset = Random.Range(recoil.MinZVariance, recoil.MaxZVariance); return(new Vector3(xOffset, yOffset, zOffset)); }
public void SetRecoilSettings(GunSettings.RecoilSettings hipRecoilSettings, GunSettings.RecoilSettings aimRecoilSettings) { hipRecoil = hipRecoilSettings.FirstPersonRecoil; aimRecoil = aimRecoilSettings.FirstPersonRecoil; }