Description

Calling HideBoneByName on a bone causes that bone (and all it's children) to be translated to the parent bone's location.  This code in UpdateRefToLocalMatricesInner is responsible:

bool bNeedToHideBone = BoneVisibilityStates[ThisBoneIndex] != BVS_Visible;
if (bNeedToHideBone && ParentIndex != INDEX_NONE)
{
    ReferenceToLocal[ThisBoneIndex] = ReferenceToLocal[ParentIndex].ApplyScale(0.f);
}

This breaks any verts that are skinned to the hidden bone.  The more desirable behaviour would be for the hidden bone to remain in the same position, but for just the scale component to be set to zero.  This could be done as follows:

bool bNeedToHideBone = BoneVisibilityStates[ThisBoneIndex] != BVS_Visible;
if (bNeedToHideBone && ParentIndex != INDEX_NONE)
{
  if (BoneVisibilityStates[ThisBoneIndex] == BVS_ExplicitlyHidden)
  {
    ReferenceToLocal[ThisBoneIndex] = (FMatrix44f)ComponentTransform[ThisBoneIndex].ToMatrixWithScale().ApplyScale(0.f);
  }
  else
  {
    ReferenceToLocal[ThisBoneIndex] = ReferenceToLocal[ParentIndex].ApplyScale(0.f);
  }								
} 

We will need to gate any change like this behind a cvar to avoid behaviour changes for projects relying on the current behaviour.

Steps to Reproduce
  1. Create a new Character blueprint
  2. Specify the mesh
  3. In the event graph, create a custom event and call the HideBoneByName node from the mesh component
    1. Specify which bone you want to hide
  4. Drop the character into the level viewport
  5. In the Level blueprint, make a reference to your character and call your custom event on a key/button press
  6. PIE
  7. Hit the key/button you specified and note how the bone (and it's children) are hidden but also note how the skinning appears to be collapsed in on itself.  This is because the location of the bone specified to be hidden has moved to the parent location
    1. The attached screenshot shows this behaviour (the mesh on the left) vs hiding the bone by setting it's scale to 0 in an anim blueprint (mesh on the right).  This shows the different effect on the skinning

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-220481 in the post.

1
Login to Vote

Unresolved
ComponentUE - Anim
Target Fix5.6
CreatedJul 30, 2024
UpdatedSep 26, 2024
View Jira Issue