From cafc0f3c10343b89f5cc555c0ef975a65e775cae Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 26 Jul 2021 08:28:01 +0300 Subject: [PATCH] Fix ridiculously accurate bullets when you shoot behind with enabled free camera --- src/weapons/Weapon.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 6f0e9094..6eab1a65 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -592,6 +592,16 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource) { CVector src, trgt; TheCamera.Find3rdPersonCamTargetVector(info->m_fRange, *fireSource, src, trgt); +#ifdef FREE_CAM + CPed *shooterPed = (CPed *)shooter; + if((shooterPed->m_pedIK.m_flags & CPedIK::GUN_POINTED_SUCCESSFULLY) == 0) { + trgt.x = info->m_fRange; + trgt.y = 0.0f; + trgt.z = 0.0f; + + shooterPed->TransformToNode(trgt, PED_HANDR); + } +#endif #ifdef FIX_BUGS // fix muzzleflash rotation