A_SetPitch
Jump to navigation
Jump to search
native void A_SetPitch(double pitch = 0, int flags = 0, int ptr = AAPTR_DEFAULT)
Usage
Sets the pitch of the calling actor (or the ptr actor) to pitch.
In ZScript, pitch is a directly modifiable Actor field; however, this function allows for sub-tic interpolation, making the change in pitch appear smooth, which is not achievable otherwise. In DECORATE this function is the only way to change pitch.
Parameters
- double pitch
- The actor's new angle in degrees. This is an absolute value, so, if a relative angular change is desired, an expression referencing the actor's
anglefield is needed.
- int flags
- Two flags are available (and can be combined with
|):- SPF_INTERPOLATE — the pitch is interpolated from old to new one.
- SPF_FORCECLAMP — the resulting pitch is clamped to [-90, 90] (which is normally the maximum/minimum pitch values). This flag is always set if the function is called on a PlayerPawn (Verification needed).
- int ptr
- DECORATE-style pointer to the actor whose pitch will be changed. Not necessary in ZScript.
Examples
This Shotgun slightly kicks the player's view horizontally (with A_SetAngle) and vertically.
class KickingShotgun : Shotgun
{
States
{
Fire:
SHTG A 3;
SHTG A 7
{
A_FireShotgun();
A_SetAngle(self.angle + frandom(-3, 3), SPF_INTERPOLATE);
A_SetPitch(self.pitch + frandom(3, 5), SPF_INTERPOLATE|SPF_FORCECLAMP);
}
SHTG BC 5;
SHTG D 4;
SHTG CB 5;
SHTG A 3;
SHTG A 7 A_ReFire;
Goto Ready;
}
}