UAnimNotify::Notify not called during USkeletalMeshComponent interaction with UPhysicsControlComponent when PhysicsBlendWeight is zero.
The licensee has provided his analysis of the code:
If USkeletalMeshComponent::TickComponent decides to use USkeletalMeshComponent::EndPhysicsTickComponent because USkeletalMeshComponent::ShouldBlendPhysicsBones is true in USkeletalMeshComponent::ShouldRunEndPhysicsTick, it can happen that USkeletalMeshComponent::ShouldBlendPhysicsBones is false in USkeletalMeshComponent::EndPhysicsTickComponent and then USkeletalMeshComponent::BlendInPhysicsInternal is not called, the process does not continue, USkeletalMeshComponent::FinalizeAnimationUpdate is not called and therefor anim notifies are not triggered.
In our case the problem is that when USkeletalMeshComponent::TickComponent is called USkeletalMeshComponent::DoAnyPhysicsBodiesHaveWeight returns true and it decides to use USkeletalMeshComponent::EndPhysicsTickComponent. After that, UPhysicsControlComponent::TickComponent modifies PhysicsBlendWeight of Bodies so when USkeletalMeshComponent::EndPhysicsTickComponent is called USkeletalMeshComponent::DoAnyPhysicsBodiesHaveWeight returns false.
Since they are setting PhysicsBlendWeight to zero, DoAnyPhysicsBodiesHaveWeight return false and that skips FinalizeAnimationUpdate(), also skipping sending the Notification.
The licensee was expecting a more consistent behavior detached from the PhysicsBlendWeight value:
It looks to us that there's an issue where the return values of both calls to ShouldBlendPhysicsBones should be consistent and are not in some cases, causing the notifies trigger process to be completely lost in some ticks. Should we be more careful when modifying the physics blend weights? Maybe the return value of ShouldBlendPhysicsBones should be cached in the first instance to ensure the notifications are triggered at the end?
Test results:
UE version Error is reproduced
Vanilla 5.0.3 Not implemented
Vanilla 5.1.1 Not implemented
Vanilla 5.2.1 Not implemented
Vanilla 5.3.2 Not implemented
Vanilla 5.4.4 Yes
Vanilla 5.5.4 Yes
Perforce Latest (07/04) Yes
I strongly recommend using the repro project as the setup is complex to describe using step-by-step.
Open the provided repro project and Play-In-Editor.
Check the warnings in the logs and notice that Notification added is called twice after Set physics blend weight set to 0.0f - during the frame of the first Notification added the Notification is not called.
Example logs provided:
[2025.03.27-13.42.14:739][345]LogAnimNotify: Warning: Notification added
[2025.03.27-13.42.14:741][345]LogAnimNotify: Warning: Notification triggered
[2025.03.27-13.42.14:741][345]LogAnimNotify: Warning: Set physics blend weight to 0.0f
[2025.03.27-13.42.14:750][346]LogAnimNotify: Warning: Notification added
[2025.03.27-13.42.14:761][347]LogAnimNotify: Warning: Notification added
[2025.03.27-13.42.14:762][347]LogAnimNotify: Warning: Notification triggered
[2025.03.27-13.42.14:762][347]LogAnimNotify: Warning: Set physics blend weight to 1.0f
Expected result: The notification should be called every frame
Actual result: The notification is skipped intermittently after setting blend weight to 0.0f.
> UnrealEditor-Engine.dll!USkeletalMeshComponent::DoAnyPhysicsBodiesHaveWeight() Line 382 C++
UnrealEditor-Engine.dll!USkeletalMeshComponent::ShouldBlendPhysicsBones() Line 376 C++
UnrealEditor-Engine.dll!USkeletalMeshComponent::ShouldRunEndPhysicsTick() Line 573 C++
[Inline Frame] UnrealEditor-Engine.dll!USkeletalMeshComponent::UpdateEndPhysicsTickRegisteredState() Line 579 C++
UnrealEditor-Engine.dll!USkeletalMeshComponent::RegisterComponentTickFunctions(bool bRegister) Line 505 C++
UnrealEditor-Engine.dll!UActorComponent::RegisterAllComponentTickFunctions(bool bRegister) Line 1289 C++
UnrealEditor-Engine.dll!AActor::BeginPlay() Line 4230 C++
UnrealEditor-Engine.dll!APawn::BeginPlay() Line 179 C++
UnrealEditor-Engine.dll!AActor::DispatchBeginPlay(bool bFromLevelStreaming) Line 4193 C++
UnrealEditor-Engine.dll!AWorldSettings::NotifyBeginPlay() Line 305 C++
UnrealEditor-Engine.dll!AGameStateBase::HandleBeginPlay() Line 228 C++
UnrealEditor-Engine.dll!AGameModeBase::StartPlay() Line 206 C++
UnrealEditor-Engine.dll!UWorld::BeginPlay() Line 5330 C++
UnrealEditor-Engine.dll!UGameInstance::StartPlayInEditorGameInstance(ULocalPlayer * LocalPlayer, const FGameInstancePIEParameters & Params) Line 568 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::CreateInnerProcessPIEGameInstance(FRequestPlaySessionParams & InParams, const FGameInstancePIEParameters & InPIEParameters, int InPIEInstanceIndex) Line 3141 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::OnLoginPIEComplete_Deferred(int LocalUserNum, bool bWasSuccessful, FString ErrorString, FPieLoginStruct DataStruct) Line 1590 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::CreateNewPlayInEditorInstance(FRequestPlaySessionParams & InRequestParams, const bool bInDedicatedInstance, const EPlayNetMode InNetMode) Line 1853 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::StartPlayInEditorSession(FRequestPlaySessionParams & InRequestParams) Line 2872 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::StartQueuedPlaySessionRequestImpl() Line 1167 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::StartQueuedPlaySessionRequest() Line 1068 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1902 C++
UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 550 C++
UnrealEditor.exe!FEngineLoop::Tick() Line 5921 C++
[Inline Frame] UnrealEditor.exe!EngineTick() Line 61 C++
UnrealEditor.exe!GuardedMain(const wchar_t * CmdLine) Line 180 C++
UnrealEditor.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 247 C++
UnrealEditor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 298 C++
[External Code]
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-263179 in the post.
0 |
Component | UE - Anim - Synthesis - Physics Control |
---|---|
Affects Versions | 5.4, 5.5.4 |
Target Fix | 5.6 |
Created | Mar 30, 2025 |
---|---|
Updated | Apr 16, 2025 |