How to use Copy Pose From Mesh?

Hello,

I’m starting to develop a game where the character is made of multiple skeletal meshes.

The 4.11 release came with the Copy Pose From Mesh animation node, which is said in the release notes to be better than SetMasterPoseComponent.

But how to use that node? Here is what I did:

I created a new animation blueprint, where I get a reference to the root skeletal mesh during the initialization, and use that mesh as the argument to the CopyPoseFromMesh node in the anim graph:

In the construction script of my character, I create the various skeletal meshes, and attach the children to the main one, but I DONT call SetMasterPoseComponent.

In the blueprint of my character, I set the main animation blueprint to the root skeletal mesh, and assign the “child” animation blueprint to the children.

The editor crashes in the following class FAnimNode_CopyPoseFromMesh in the function Evaluate at the line:

OutPose[PoseBoneIndex] = CurrentlyUsedSourceMeshComponent.Get()->GetSpaceBases()[SourceBoneIndex];

with the assertion:

Assertion failed: (Index >= 0) & (Index < ArrayNum) [File:D:\BuildFarm\buildmachine_++UE4+Release-4.11\Engine\Source\Runtime\Core\Public\Containers\Array.h] [Line: 785] 
Array index out of bounds: 0 from an array of size 0

But if I call SetMasterPoseComponent, I don’t get the same assert, and I can assign the child animation blueprint to the child skeletal mesh.

But now, I don’t get the point, because I can have exactly the same behavior by just using the SetMasterPoseComponent call.

So is CopyNodeFromMesh just meant to be used in addition to SetMasterPoseComponent, if and only if we need to play additional animations on the child skeletal mesh?

Thanks!

It’s probably a simple oversight. Check your node network - maybe start with attaching just one child.

Using 4.11.2, I got it to work in my test where, previously, I was trying to get SetMasterPoseComponent to work with slave components that have additional bones (e.g pony tail bones for the hair mesh component). The additional bones didn’t transform, and reading “SkinnedMeshComponent.cpp” confirmed that bones in the slave that are not in the master do not transform after SetMasterPoseComponent.

The new CopyPoseFromMesh, on the other hand, works with child mesh components that have additional bones. I haven’t tried blending in pony tail animation yet - I used the simple “follow the parent” child anim BP just like your example. And I deleted the SetMasterPoseComponent node.

I think I did it pretty much exactly as you described for your test:

  1. In the construction script, I added the skeletal mesh component → set it to variable “Hair” → assigned the hair skeletal mesh to it → attached it to the main Mesh component.
  2. I set the Hair anim instance class to the simple child anim BP in the event graph for Begin Play, and followed that with PlayAnimation on the main Mesh with a simple animation sequence set to loop. PIE, and the pony tail follows the main mesh perfectly (with SetMasterPoseComponent, the pony tail would transform to the root bone location and end up with hideous mesh deformation.)

For me, the advantage the new feature has over SetMasterPoseComponent is precisely what I was looking for, where the attachments have additional bones and have them transform correctly relative to the parent bones in the source mesh - and also be able to apply animation to the additional bones in the child.