Skip to content

Commit d29c2e6

Browse files
committed
Near perfect match of unarmed head yaw compared to vanilla
1 parent a2b5744 commit d29c2e6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/xrGame/ActorAnimation.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ static const float p_spin0_factor = 0.0f;
3030
static const float p_spin1_factor = 0.2f;
3131
static const float p_shoulder_factor = 0.7f;
3232
static const float p_head_factor = 0.1f;
33+
static const float p_head_unarmed_factor = 0.9f;
3334
static const float r_spin0_factor = 0.3f;
3435
static const float r_spin1_factor = 0.3f;
3536
static const float r_shoulder_factor = 0.2f;
@@ -86,7 +87,8 @@ void CActor::HeadCallback(CBoneInstance* B)
8687
VERIFY(A);
8788
Fmatrix spin;
8889
float bone_yaw = angle_normalize_signed(A->r_torso.yaw - A->r_model_yaw - A->r_model_yaw_delta) * y_head_factor;
89-
float bone_pitch = angle_normalize_signed(A->r_torso.pitch) * p_head_factor;
90+
float correctedHeadFactor = A->inventory().GetActiveSlot() == NO_ACTIVE_SLOT ? p_head_unarmed_factor : p_head_factor;
91+
float bone_pitch = angle_normalize_signed(A->cam_Active()->GetWorldPitch()) * correctedHeadFactor;
9092
float bone_roll = angle_normalize_signed(A->r_torso.roll) * r_head_factor;
9193
Fvector c = B->mTransform.c;
9294
spin.setXYZ(-bone_pitch, bone_yaw, bone_roll);

0 commit comments

Comments
 (0)