I'm creating a Recoil system for a mod I'm working on and I've noticed that the usage of the SPF_INTERPOLATE flag in A_SetPitch and A_SetAngle sometimes leads to a rubberband effect because of (supossedly) the way ZDoom handles mouse movement
Here is a video https://drive.google.com/file/d/1RZWbNV ... sp=sharing showing what I mean, the MP40 has this effect, and the SMG does not
Also, if you move the view to the left / right with the arrow keys instead of the mouse, it does not happen
These are the relevant code blocks, this first one generates the rubberband effect:
Code: Select all
ResumeFireFrame:
MP40 A 0 A_JumpIfInventory("Zoomed",1,"Fire2")
MP40 A 0 A_PlaySound("MP40/Fire", 1)
MP40 A 0 A_PlaySound("FARSHT", 6)
MP40 A 0 A_AlertMonsters
MP40 A 0 ACS_NamedExecuteWithResult("SetRecoil", Random(20,30), Random(-20,20))
MP40 B 1 BRIGHT A_FireBullets (3, 3, -1, 18, "WeakPuff", FBF_NORANDOM)
TNT1 A 0 A_SetPitch(pitch-0.01*CallACS("Pitch"), SPF_INTERPOLATE)
TNT1 A 0 A_SetAngle(angle-0.01*CallACS("Angle"), SPF_INTERPOLATE)
MP40 A 0 A_ZoomFactor(0.998)
MP40 D 1
TNT1 A 0 A_SetPitch(pitch-0.01*CallACS("Pitch"), SPF_INTERPOLATE)
TNT1 A 0 A_SetAngle(angle-0.01*CallACS("Angle"), SPF_INTERPOLATE)
MP40 A 0 A_ZoomFactor(1.0)
MP40 A 0 A_FireCustomMissile("DecorativeTracer", random(-1,1), 0, 0, -12, 0, random(-1,1))
MP40 E 1 A_FireCustomMissile("PistolCaseSpawn",-5,0,8,-4)
TNT1 A 0 A_SetPitch(pitch+0.02*CallACS("Pitch"), SPF_INTERPOLATE)
TNT1 A 0 A_SetAngle(angle+0.02*CallACS("Angle"), SPF_INTERPOLATE)
MP40 A 1
MP40 A 0 A_Refire
Goto Ready3
Code: Select all
ResumeFireFrame:
MP40 A 0 A_JumpIfInventory("Zoomed",1,"Fire2")
MP40 A 0 A_PlaySound("MP40/Fire", 1)
MP40 A 0 A_PlaySound("FARSHT", 6)
MP40 A 0 A_AlertMonsters
MP40 A 0 ACS_NamedExecuteWithResult("SetRecoil", Random(20,30), Random(-20,20))
MP40 B 1 BRIGHT A_FireBullets (3, 3, -1, 18, "WeakPuff", FBF_NORANDOM)
MP40 A 0 A_SetPitch(pitch-0.01*CallACS("Pitch"), SPF_INTERPOLATE)
MP40 A 0 A_SetAngle(angle-0.01*CallACS("Angle"), SPF_INTERPOLATE)
MP40 A 0 A_ZoomFactor(0.998)
MP40 D 1
MP40 A 0 A_SetPitch(pitch-0.01*CallACS("Pitch"), SPF_INTERPOLATE)
MP40 A 0 A_SetAngle(angle-0.01*CallACS("Angle"), SPF_INTERPOLATE)
MP40 A 0 A_ZoomFactor(1.0)
MP40 A 0 A_FireCustomMissile("DecorativeTracer", random(-1,1), 0, 0, -12, 0, random(-1,1))
MP40 E 1 A_FireCustomMissile("PistolCaseSpawn",-5,0,8,-4)
MP40 A 0 A_SetPitch(pitch+0.01*CallACS("Pitch"), SPF_INTERPOLATE)
MP40 A 0 A_SetAngle(angle+0.01*CallACS("Angle"), SPF_INTERPOLATE)
MP40 A 1
MP40 A 0 A_SetPitch(pitch+0.01*CallACS("Pitch"), SPF_INTERPOLATE)
MP40 A 0 A_SetAngle(angle+0.01*CallACS("Angle"), SPF_INTERPOLATE)
MP40 A 0 A_Refire
Goto Ready3
Thanks in advance
Best regards