Blending bug in FAnimNode_RandomPlayer

Hello,

So we were looking at a rewind debugger capture of a character have animating, and we noticed that when his state machine started transitioning back to his idle state (which uses FAnimNode_RandomPlayer), the blend weight of the chosen idle started immediately at 1 even during blend in. And when he left the idle state to another state, the idle anim remained at a weight of 1 even during blend out. I took a look at FAnimNode_RandomPlayer::Update_AnyThread and noticed that when determining the weight of the samples, it doesn’t use the actual anim node weight

`FAnimTickRecord TickRecord(CurrentData->Entry->Sequence, true, CurrentData->PlayRate, false, CurrentData->BlendWeight, CurrentData->CurrentPlayTime, CurrentData->MarkerTickRecord);
TickRecord.DeltaTimeRecord = &CurrentData->DeltaTimeRecord;
TickRecord.GatherContextData(Context);

UE::Anim::FAnimSyncGroupScope& SyncScope = Context.GetMessageCheckedUE::Anim::FAnimSyncGroupScope();
SyncScope.AddTickRecord(TickRecord, UE::Anim::FAnimSyncParams(), UE::Anim::FAnimSyncDebugInfo(Context));

TRACE_ANIM_TICK_RECORD(Context, TickRecord);

if (FAnimationRuntime::HasWeight(NextData->BlendWeight))
{
FAnimTickRecord NextTickRecord(NextData->Entry->Sequence, true, NextData->PlayRate, false, NextData->BlendWeight, NextData->CurrentPlayTime, NextData->MarkerTickRecord);`

What I did was make sure the data blend weights were scaled by the actual node’s weight. Doing this seemed to provide the correct blend weights during transitions according to the rewind debugger:

`FAnimTickRecord TickRecord(CurrentData->Entry->Sequence, true, CurrentData->PlayRate, false, CurrentData->BlendWeight * BlendWeight, CurrentData->CurrentPlayTime, CurrentData->MarkerTickRecord);
TickRecord.DeltaTimeRecord = &CurrentData->DeltaTimeRecord;
TickRecord.GatherContextData(Context);

UE::Anim::FAnimSyncGroupScope& SyncScope = Context.GetMessageCheckedUE::Anim::FAnimSyncGroupScope();
SyncScope.AddTickRecord(TickRecord, UE::Anim::FAnimSyncParams(), UE::Anim::FAnimSyncDebugInfo(Context));

TRACE_ANIM_TICK_RECORD(Context, TickRecord);

if (FAnimationRuntime::HasWeight(NextData->BlendWeight * BlendWeight))
{
FAnimTickRecord NextTickRecord(NextData->Entry->Sequence, true, NextData->PlayRate, false, NextData->BlendWeight * BlendWeight, NextData->CurrentPlayTime, NextData->MarkerTickRecord);`

Does this look correct to you guys?

Thanks,

Andy

Hey

Good catch and thanks! We’ve made the adjustment and submitted on our side as well.

Dustin

No problem. Thanks!