I’ve got an FAnimNode_SkeletalControlBase where I am manipulating some bones. I am taking a bone and rotating it to face the world origin (0,0,0). However, this doesn’t seem to be working properly as the bone is just spinning like a giant fan blade in the same direction as the player is facing.
// Rotation that is facing world origin from CurrentBoneLocation(0,0,0)
FRotator CurrentBoneRotation = UKismetMathLibrary::FindLookAtRotation(CurrentBoneLocation, FVector(0.f, 0.f, 0.f);
// Convert CurrentBoneRotation from world-space to component-space
CurrentBoneRotation = UKismetMathLibrary::InverseTransformRotation(
Output.AnimInstanceProxy->GetComponentTransform(), CurrentBoneRotation
);
// Convert CurrentBoneRotation from component-space to bone-space, wrapping the rotation in an FTransform
FTransform BoneTransform = FTransform(CurrentBoneRotation, FVector(0.f), FVector(0.f));
FAnimationRuntime::ConvertCSTransformToBoneSpace(Output.AnimInstanceProxy->GetSkelMeshComponent(), Output.Pose, BoneTransform, CurrentBoneIndex, EBoneControlSpace::BCS_BoneSpace);
OutBoneTransforms.Add(FBoneTransform(CurrentBoneIndex, FTransform(BoneTransform.GetRotation(), CurrentBoneLocation, FVector(1.f)));
Is this correct? I’ve looked over this at least a few dozen times. I’ve also tried switching around the values for CurrentBoneRotation’s axes, however that does not work as well.