• Weapon Blowblack - How to do this?
    0 replies, posted
Hello Facepunch! Now, one of the concepts I wanted to explore was SWEP:GetViewModelPosition-based recoil blowblack. The reason for this is due to some animations on weapons moving off diagonally, therefore throwing the user's recoil off and looking pretty bad. I decided I would do this via Lerp. My code so far (at least as a test) is: [code]if self:GetIronsights() and self:GetNextPrimaryFire() > CurTime() then if self.CurrentLerpPos == self.LerpMaxPos then self.CurrentLerpPos = Lerp( FrameTime() * 10, self.CurrentLerpAmt, 0 ) else self.CurrentLerpPos = Lerp( FrameTime() * 10, self.CurrentLerpAmt, self.LerpMaxAmt ) end pos = pos - ang:Forward() * self.CurrentLerpPos end[/code] (self.CurrentLerpAmt and self.LerpMaxAmt are both defined as 0 at the top of the SWEP code) Now, of course this will repeatedly do the lerp animation as long as GetNextPrimaryFire is above CurTime, which doesn't really get the desired effect. How would I go about doing this correctly? (as in, when you fire, it only lerps back and forth once, instead of repeating it until you can fire again) Thank you!
Sorry, you need to Log In to post a reply to this thread.