A_SetPitch
Jump to navigation
Jump to search
A_SetPitch (float pitch [, int flags [, int ptr]])
Usage
A_SetPitch sets the calling actor's or the pointed to actor's pitch to the value of the first parameter. It can be used with the pitch DECORATE variable to modify the actor's current pitch.
For players, the pitch will be clamped to the [-90, 90] range. The limit can be applied to other actors as well with the SPF_FORCECLAMP flag.
Parameters
- pitch: The actor's new pitch, in degrees. Negative numbers makes actor aim higher, while positive numbers make the actor aim lower.
- flags: The following flags can be combined by using the pipe character | between the constants names:
- SPF_FORCECLAMP: Forces the pitch to be within [-90, 90] range. This flag is always forced on for players.
- SPF_INTERPOLATE: Interpolates the view.
- ptr: The actor to change its pitch angle. This is an actor pointer. Default is AAPTR_DEFAULT, which corresponds to the calling actor.
Examples
This firing script uses A_SetPitch to add vertical recoil to the pistol.
Fire: PISG A 0 A_GunFlash PISG A 0 Offset(3, 39) A_FireBullets(1, 1, -1, 12,"BulletPuff") PISG A 0 A_SetPitch(pitch-1) //Kick the aim up PISG B 3 A_PlaySound("Weapons/Pistol") PISG CC 1 Offset(2, 37) A_SetPitch(pitch+0.25) //Lower the aim back down PISG DD 1 Offset(1, 35) A_SetPitch(pitch+0.25) PISG A 0 Offset(0, 32) Goto Ready
A more advanced version:
Fire: PISG A 0 A_GunFlash PISG B 0 Offset(3, 39) A_FireBullets(1, 1, -1, 12,"BulletPuff") PISG A 0 A_Jump(128, 2) PISG A 0 A_SetAngle(angle+((abs(velx)+abs(vely)+abs(velz))/10)) PISG A 0 A_Jump(256, 1) PISG A 0 A_SetAngle(angle-((abs(velx)+abs(vely)+abs(velz))/10)) PISG A 0 A_SetPitch(pitch-((abs(velx)+abs(vely)+abs(velz))/6)) PISG B 3 A_PlaySound("Weapons/Pistol") PISG C 2 Offset(2, 37) PISG D 2 Offset(1, 35) PISG A 0 Offset(0, 32) Goto Ready