hello. as you see in the video, my left hand position is wrong when I look up or down.
LeftHandTransform = EquippedWeapon->GetWeaponMesh()->GetSocketTransform(FName("LeftHandSocket"), RTS_World);
FVector OutPosition;
FRotator OutRotation;
ShooterCharacter->GetMesh()->TransformToBoneSpace(FName("hand_r"), LeftHandTransform.GetLocation(), LeftHandTransform.GetRotation().Rotator(), OutPosition, OutRotation);
LeftHandTransform.SetLocation(OutPosition);
LeftHandTransform.SetRotation(FQuat(OutRotation));
if (ShooterCharacter->IsLocallyControlled() && !ShooterCharacter->GetDisableGameplay())
{
bLocallyControlled = true;
FTransform RightHandTransform = EquippedWeapon->GetWeaponMesh()->GetSocketTransform(FName("Hand_R"), RTS_World);
FRotator LookAtRotation = UKismetMathLibrary::FindLookAtRotation(RightHandTransform.GetLocation(), RightHandTransform.GetLocation() + (RightHandTransform.GetLocation() - ShooterCharacter->GetHitTarget()));
RightHandRotation = FMath::RInterpTo(RightHandRotation, LookAtRotation, DeltaTime, 30.f);
I calculated LeftHandTransform and Right Hand Transform like above.
And I use Transform(modify) root with RightHandTransfrom and after that use FABRIK with LeftHandRotation to attach my left hand to weapon.
I think the problem is the hand_r is rotated but the left hand is not rotated. how can I fix this? It is so hard…
Thanks in forward!