Epic C++ comment: ...if on an anim node initialize the reference in CacheBones?? How to do it?

I encounter a crash with the following error call stack:

Assertion failed: Pose.IsValidIndex(BoneIndex) [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Public\BonePose.h] [Line: 568]

UnrealEditor_AnimGraphRuntime!FAnimNode_AnimDynamics::InitPhysics() [D:\build\++UE5\Sync\Engine\Source\Runtime\AnimGraphRuntime\Private\BoneControllers\AnimNode_AnimDynamics.cpp:714] UnrealEditor_AnimGraphRuntime!FAnimNode_AnimDynamics::EvaluateSkeletalControl_AnyThread()
[D:\build\++UE5\Sync\Engine\Source\Runtime\AnimGraphRuntime\Private\BoneControllers\AnimNode_AnimDynamics.cpp:282]

According to the comment for this assertion failure:
// Invalid index supplied. If this came from an FBoneReference make sure you are
// handling lod changes properly. (for instance: if on an anim node initialize the reference in CacheBones)

It seems to suggest there is a mismatch between the bone index provided by anim dynamic node and bone available for skeletalmesh LOD.

Which make sense to me, however, how do I solve the issue by Initialize the reference CacheBone as the comment suggested?

I dunno if this helps you (not a programmer) but I managed to solve this crash (got it on game-end when using look-at on head and neck bones).
I solved it by caching the pose instead of going directly into the output pose.

1 Like

Hmm interesting, I haven’t thought about caching pose before calling anim dynamic node, I’ll give it a try and see if it solves the problem.

Thank you for sharing your solution!