Local bone rotation

I can’t seem to get the local/relative bone rotation during an animation

I tried:

FTransform parent = Mesh->GetBoneTransform(parentIndex);
FTransform child = Mesh->GetBoneTransform(childIndex);
FTransform localA = child * parent.Inverse();
FTransform localB = child.GetRelativeTransform(parent); // same as localA
FRotator rot = localA.Rotator();
Mesh->TransformToBoneSpace(...) // also didn't work

I’m testing a skeleton that only animates the chest. The parent bone is the upper arm and the child bone is the lower arm.
When I try to get the local rotation the values look more like global rotations.

Setting the rotation seems fine: Finding bone-local transforms - Character & Animation - Unreal Engine Forums
I don’t think I can use this method to find the local rotation. It looks like it just finds the component space reference pose and sets the rotation.

USkinnedMeshComponent *Mesh = Cast(GetMesh());
if (Mesh)
{
FQuat TestQ = Mesh->GetBoneQuaternion(TEXT(“lowerArm”), EBoneSpaces::WorldSpace);
FQuat TestQ2 = Mesh->GetBoneQuaternion(TEXT(“upperArm”), EBoneSpaces::WorldSpace);
FQuat local = TestQ2.Inverse() * TestQ;
}

There used to be a local bone space but it was removed for some reason.

1 Like

Exactly what I was looking for, thanks.

Hello savior from the past. We’re mid-2017 and tonight you’re my hero. :smiley:

Is there any way to set bone local rotation in blueprint?

1 Like

THIS! I need to know if there is a good way to retrieve the local-space FRotator of a bone so I can detect animations regardless of where the character is facing in world space.