Trying to hide a specific bone on an ACharacter

Hi, I’m new with UE4, and decided I would start with something simple, like hiding a bone. But it has proven more difficult than I originally intended.
I’ve tried:
Code:



USkeletalMeshComponent* SkeletalMesh = GetMesh();
SkeletalMesh->HideBone(SkeletalMesh->GetBoneIndex(FName(TEXT("lowerarm_r"))), PBO_None);

No sure what you exactly mean by “hiding a bone”. After inspecting USkeletalMeshComponent::HideBone, you can see it just removes physical objects (“simulated” objects) from PhysX – therefore it removes “bone” (and all objects down in the hierarchy with it) from ragdoll. I doubt it affects rendering (a visual part of skeletal mesh) in any way as it is much more complicated task. I remember days when it was needed when working on a game and it was solved by scaling down to zero bone transformations. Therefore vertices bound to those bones collapsed to a single point.

To any wayward wanderers of the future, one trick that worked for me is to do the bone hiding inside AYourCharacterClass::BeginPlay()

For some reason it doesn’t work if done in a constructor, or at least I am unable to get it to work.

EDIT: I should also note that as far as I can tweak it, if you hide a bone, Unreal will hide all child bones. It works for me as I’m trying to hide a whole arm, but yea I don’t know how to do that use case. Here’s a thread for just this issue btw Hide/Unhide a specific bone by name - #3 by dodolfo44