void AFPSurvivalCharacter::SetAimSocket()
{
if(CurrentWeapon != nullptr)
{
const auto AimPointTransform = CurrentWeapon->GetMesh()->GetSocketTransform(TEXT("aimPoint"));
const auto HandGunWorldTransform = Mesh1P->GetSocketTransform(TEXT("ik_hand_gun"));
const auto HandGunComponentTransform = Mesh1P->GetSocketTransform(TEXT("ik_hand_gun"), RTS_Component);
const auto AimSocketTransform = HandGunWorldTransform.GetRelativeTransform(AimPointTransform);
AimSocketLocation = AimSocketTransform.GetLocation() + HandGunComponentTransform.GetLocation();
AimSocketRotator = AimSocketTransform.Rotator() + HandGunComponentTransform.Rotator();
}
}
SetAimSocket is member function of my character class.
and CurrentWeapon is another actor that refers gun.
what I want is change ik_hand_gun bone’s transform to aimPoint socket’s location, but this code doesn’t give me that kind of result.
this code calculates relative transform of aimPoint socket and ik_hand_gun bone, and contains it in AimSocketLocation and Rotator - member variable of AFPSurvivalCharacter.
bone on the right side of the character is the ik_hand_gun bone.
if this code is working well, than it must be on the pistol’s iron sight location.
and in animation blueprint, it used for modify ik_hand_gun transform.

what is wrong with this method? did I do something wrong?
please help me.