if(bWeaponEquipped && EquippedWeapon && EquippedWeapon->GetWeaponMesh() && PlayerCharacter->GetMesh())
{
LeftHandTransform = EquippedWeapon->GetWeaponMesh()
->GetSocketTransform(FName("LeftHandSocket"), RTS_World);
FVector OutPosition;
FRotator OutRotation;
PlayerCharacter->GetMesh()->TransformToBoneSpace(FName("右手首"), LeftHandTransform.GetLocation(), FRotator::ZeroRotator, OutPosition, OutRotation);
UE_LOG(LogTemp, Log, TEXT("OutPosition: X = %f, Y = %f, Z = %f"), OutPosition.X, OutPosition.Y, OutPosition.Z);
UE_LOG(LogTemp, Log, TEXT("OutRotation: Pitch = %f, Yaw = %f, Roll = %f"), OutRotation.Pitch, OutRotation.Yaw, OutRotation.Roll);
LeftHandTransform.SetLocation(OutPosition);
LeftHandTransform.SetRotation(FQuat(OutRotation));
}
我是一个新手,在尝试使用FABRIK,将左手固定在枪械某部位。这里的TransformToBoneSpace
接受一个Bone Name,我发现他调用了GetBoneIndex
获取Index,填入我使用骨骼的BoneName,获取到了-1,即INDEX_NONE,我该怎么处理,解决这个问题。