mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-10 06:34:16 +00:00
fix for arm rotating in wrong direction when holding a single-arm weapon
This commit is contained in:
parent
eb7503b66d
commit
e64d2ce427
1 changed files with 5 additions and 1 deletions
|
@ -448,7 +448,11 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
|
||||
// we need to apply rotation that is opposite of given offset for x axis - to assure that forehand's up matches ped's back
|
||||
Quaternion q = Quaternion.AngleAxis( 90f - WeaponsManager.Instance.AIMWITHARM_foreArmRotationOffset.x, player.transform.up );
|
||||
endRotForeArm = Quaternion.LookRotation (q * player.transform.up, q * (-player.transform.forward));
|
||||
// This is a fix for when arm rotates in opposite direction - we need to define in which way to rotate arm to target rotation.
|
||||
// We do this by lerping from starting rotation to target rotation based on timePerc.
|
||||
Vector3 forward = Vector3.Lerp(player.transform.forward, player.transform.up, timePerc);
|
||||
Vector3 up = Vector3.Lerp(player.transform.up, -player.transform.forward, timePerc);
|
||||
endRotForeArm = Quaternion.LookRotation (q * forward, q * up);
|
||||
|
||||
} else if (isAimingOnOppositeSide) {
|
||||
// upper arm will slightly follow direction of aiming, but only along y and z axes
|
||||
|
|
Loading…
Reference in a new issue