summaryrefslogtreecommitdiffstats
path: root/src/peds/PedIK.cpp
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-08-20 20:26:19 +0200
committererorcun <erorcunerorcun@hotmail.com.tr>2021-08-20 20:26:19 +0200
commit0256790e1c18826d383f8e1eec134b2c5cecd044 (patch)
treeae6d79b8cb52db2840709c90647550c3b7221c62 /src/peds/PedIK.cpp
parentfix (diff)
downloadre3-0256790e1c18826d383f8e1eec134b2c5cecd044.tar
re3-0256790e1c18826d383f8e1eec134b2c5cecd044.tar.gz
re3-0256790e1c18826d383f8e1eec134b2c5cecd044.tar.bz2
re3-0256790e1c18826d383f8e1eec134b2c5cecd044.tar.lz
re3-0256790e1c18826d383f8e1eec134b2c5cecd044.tar.xz
re3-0256790e1c18826d383f8e1eec134b2c5cecd044.tar.zst
re3-0256790e1c18826d383f8e1eec134b2c5cecd044.zip
Diffstat (limited to 'src/peds/PedIK.cpp')
-rw-r--r--src/peds/PedIK.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/peds/PedIK.cpp b/src/peds/PedIK.cpp
index cf2e4ed5..3bc5796b 100644
--- a/src/peds/PedIK.cpp
+++ b/src/peds/PedIK.cpp
@@ -205,9 +205,15 @@ CPedIK::PointGunInDirection(float targetYaw, float targetPitch)
else if (status == ANGLES_SET_EXACTLY)
m_flags |= GUN_POINTED_SUCCESSFULLY;
}
- RwMatrix *m = GetBoneMatrix(m_ped, BONE_spine); // BUG: game uses index 2 directly, which happens to be identical to BONE_spine
+#ifdef FIX_BUGS
+ RwMatrix *m = GetBoneMatrix(m_ped, BONE_spine);
+#else
+ RpHAnimHierarchy* hier = GetAnimHierarchyFromSkinClump(m_ped->GetClump());
+ RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier);
+ RwMatrix *m = &mats[2];
+#endif
RwV3d axis = { 0.0f, 0.0f, 0.0f };
- float axisangle = -CGeneral::LimitRadianAngle(Atan2(-m->at.y, -m->at.x) - m_ped->m_fRotationCur);
+ float axisangle = -CGeneral::LimitRadianAngle(Atan2(-m->up.y, -m->up.x) - m_ped->m_fRotationCur);
axis.y = -Sin(axisangle);
axis.z = Cos(axisangle);