Starting with ALT://R6, all shotgun-type weapons will fire in the direction the player camera is facing, rather than in the direction the muzzle of the weapon is pointing.
In the InjectFireFromWeaponMuzzle patch, BulletWeapon.Fire() is hooked and the player FPSCamera position and direction is changed to that of the weapon's MuzzleAlign. At the time of implementation, weapons would fire forwards from the center of the camera.
In more recent versions of the game, shotgun-type weapons have been subclassed into Shotgun, with its own Shotgun.Fire() implementation, meaning the above patch does not affect it.
The reason this never broke anything is because, up until ALT://R5, they had both been changed to use the position and orientation of the weapon MuzzleAlign, rather than the camera transform, making the above patch redundant.
With Alt://R6, Shotgun.Fire() in particular was heavily modified, and now uses the orientation of the camera again, but not directly.
The player FPSCamera itself does not have a local transform. It is nested under a FPSCameraHolder and a FPSCameraRotation object, which handle translation and rotation respectively.
Shotgun.Fire() uses the FPSCameraRotation transform to determine where the weapon should fire, so we simply need to change its position and rotation for the duration of the call, and then revert them, similar to what InjectFireFromWeaponMuzzle does.
There does not appear to be any direct references to the FPSCameraRotation GameObject, but it is the direct parent of FPSCamera, making it easily obtainable.
The problem
Starting with
ALT://R6
, all shotgun-type weapons will fire in the direction the player camera is facing, rather than in the direction the muzzle of the weapon is pointing.broken_shotgun.webm
This only affects shotgun-type weapons.
In the
InjectFireFromWeaponMuzzle
patch,BulletWeapon.Fire()
is hooked and the playerFPSCamera
position and direction is changed to that of the weapon'sMuzzleAlign
. At the time of implementation, weapons would fire forwards from the center of the camera. In more recent versions of the game, shotgun-type weapons have been subclassed intoShotgun
, with its ownShotgun.Fire()
implementation, meaning the above patch does not affect it.The reason this never broke anything is because, up until
ALT://R5
, they had both been changed to use the position and orientation of the weaponMuzzleAlign
, rather than the camera transform, making the above patch redundant.With
Alt://R6
,Shotgun.Fire()
in particular was heavily modified, and now uses the orientation of the camera again, but not directly.The fix
fixed_shotgun.webm
The player
FPSCamera
itself does not have a local transform. It is nested under aFPSCameraHolder
and aFPSCameraRotation
object, which handle translation and rotation respectively.Shotgun.Fire()
uses theFPSCameraRotation
transform to determine where the weapon should fire, so we simply need to change its position and rotation for the duration of the call, and then revert them, similar to whatInjectFireFromWeaponMuzzle
does.There does not appear to be any direct references to the
FPSCameraRotation
GameObject, but it is the direct parent ofFPSCamera
, making it easily obtainable.