OnComponentWake Event does not trigger when the physical body is awoken by a Force.
The steps described on Steps To Reproduce is enough to replicate this behavior. The OnComponentWake event is only fired when the component collides with a physics body.
I've tried to pinpoint the issue and came across void SetObjectState(). There, bAllowEvents was set to false and the MWakeEvent was skipped. Might be the origin of the issue, so I'll add the call stack for this method during the execution of AddForce().
In an empty BP project create an Actor BP (ex. BP_TestWake)
Open up the BP and add a Sphere component - set it as Root
On the Sphere component enable GenerateWakeEvents
With Sphere selected, scroll down it's Details panel and select OnComponentWake
I suggest also adding the OnComponentSleep event to see Sleep does fire as expected
Pull from OnComponentWake(Sphere) and add a PrintString (ex. set it's string to "I'm Awake") node to verify it was fired
Pull from OnComponentSleep(Sphere) and add a PrintString (ex. set it's string to "I'm Sleeping") node to verify it was fired
On Event BeginPlay pull a Delay (ex. 5 seconds) and from it pull a AddForce(Sphere) node and set a Force (ex. X:0,0;Y:0,0;Z:1000000,0) - this is the force that will awake the component
Expected result: after 5 seconds the sphere should jump up and a "I'm awake" log would be fired
Actual result: immediately after starting the play session, we receive the "I'm sleeping" log. After 5 seconds the sphere jumps up but no log is fired - the OnComponentWake is not called. After some time the sphere has stopped we will get the "I'm sleeping" log again. This proves the state was changed but the OnComponentWake event was not called.
> UnrealEditor-PhysicsCore.dll!Chaos::TPBDRigidParticle<double,3>::SetObjectState(const Chaos::EObjectStateType InState, bool bAllowEvents, bool bInvalidate) Line 3634 C++
[Inline Frame] UnrealEditor-PhysicsCore.dll!Chaos::SetObjectStateHelper(IPhysicsProxyBase &) Line 3978 C++
[Inline Frame] UnrealEditor-PhysicsCore.dll!Chaos::TThreadedSingleParticlePhysicsProxyBase<1>::SetObjectStateBase::__l2::<lambda_1>::operator()(Chaos::TGeometryParticle<double,3> *) Line 1019 C++
[Inline Frame] UnrealEditor-PhysicsCore.dll!Chaos::TThreadedSingleParticlePhysicsProxyBase<1>::Write(const Chaos::TThreadedSingleParticlePhysicsProxyBase<1>::SetObjectStateBase::__l2::<lambda_1> &) Line 1085 C++
[Inline Frame] UnrealEditor-PhysicsCore.dll!Chaos::TThreadedSingleParticlePhysicsProxyBase<1>::SetObjectStateBase(const Chaos::EObjectStateType) Line 1015 C++
UnrealEditor-PhysicsCore.dll!Chaos::FRigidBodyHandle_External::SetObjectState(const Chaos::EObjectStateType InState, bool bAllowEvents, bool bInvalidate) Line 1199 C++
UnrealEditor-PhysicsCore.dll!FChaosStateOps<Chaos::FRigidBodyHandle_External>::AddForce(Chaos::FRigidBodyHandle_External & BodyHandle, const UE::Math::TVector<double> & Force, bool bAllowSubstepping, bool bAccelChange) Line 905 C++
[Inline Frame] UnrealEditor-Engine.dll!FBodyInstance::AddForce::__l2::<lambda_1>::operator()() Line 3529 C++
[Inline Frame] UnrealEditor-Engine.dll!Invoke(FBodyInstance::AddForce::__l2::<lambda_1> &) Line 47 C++
UnrealEditor-Engine.dll!?Call@?$TFunctionRefCaller@V<lambda_1>@?1??AddForce@FBodyInstance@@QEAAXAEBU?$TVector@N@Math@UE@@_N1UFAsyncPhysicsTimestamp@@PEAVAPlayerController@@@Z@X$$V@Function@Private@Core@UE@@SAXPEAX@Z(void * Obj) Line 321 C++
[Inline Frame] UnrealEditor-Engine.dll!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::FFunctionRefStoragePolicy,void __cdecl(Chaos::FSingleParticlePhysicsProxy * &)>::operator()(Chaos::FSingleParticlePhysicsProxy * &) Line 470 C++
UnrealEditor-Engine.dll!FPhysInterface_Chaos::ExecuteWrite(Chaos::FSingleParticlePhysicsProxy * & InActorReference, TFunctionRef<void __cdecl(Chaos::FSingleParticlePhysicsProxy * &)> InCallable) Line 580 C++
[Inline Frame] UnrealEditor-Engine.dll!FBodyInstance::ApplyAsyncPhysicsCommand(FAsyncPhysicsTimestamp TimeStamp, const bool) Line 3507 C++
UnrealEditor-Engine.dll!FBodyInstance::AddForce(const UE::Math::TVector<double> & Force, bool bAllowSubstepping, bool bAccelChange, const FAsyncPhysicsTimestamp TimeStamp, APlayerController * PlayerController) Line 3525 C++
UnrealEditor-Engine.dll!UPrimitiveComponent::AddForce(UE::Math::TVector<double> Force, FName BoneName, bool bAccelChange) Line 258 C++
UnrealEditor-Engine.dll!UPrimitiveComponent::execAddForce(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 1553 C++
UnrealEditor-CoreUObject.dll!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 7192 C++
UnrealEditor-CoreUObject.dll!UObject::CallFunction(FFrame & Stack, void * const Z_Param__Result, UFunction * Function) Line 1147 C++
[Inline Frame] UnrealEditor-CoreUObject.dll!FFrame::Step(UObject *) Line 482 C++
UnrealEditor-CoreUObject.dll!UObject::ProcessContextOpcode(FFrame & Stack, void * const Z_Param__Result, bool bCanFailSilently) Line 3117 C++
[Inline Frame] UnrealEditor-CoreUObject.dll!FFrame::Step(UObject *) Line 482 C++
UnrealEditor-CoreUObject.dll!ProcessLocalScriptFunction(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 1214 C++
UnrealEditor-CoreUObject.dll!UObject::ProcessInternal(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 1336 C++
UnrealEditor-CoreUObject.dll!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 7192 C++
UnrealEditor-CoreUObject.dll!UObject::ProcessEvent(UFunction * Function, void * Parms) Line 2175 C++
UnrealEditor-Engine.dll!AActor::ProcessEvent(UFunction * Function, void * Parameters) Line 1160 C++
UnrealEditor-Engine.dll!FLatentActionManager::TickLatentActionForObject(float DeltaTime, TMultiMap<int,FPendingLatentAction *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<int,FPendingLatentAction *,1>> & ObjectActionList, UObject * InObject) Line 319 C++
UnrealEditor-Engine.dll!FLatentActionManager::ProcessLatentActions(UObject * InObject, float DeltaTime) Line 237 C++
UnrealEditor-Engine.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1543 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 2140 C++
UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 550 C++
UnrealEditor.exe!FEngineLoop::Tick() Line 5877 C++
[Inline Frame] UnrealEditor.exe!EngineTick() Line 69 C++
UnrealEditor.exe!GuardedMain(const wchar_t * CmdLine) Line 188 C++
UnrealEditor.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 266 C++
UnrealEditor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 317 C++
[External Code]
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-252191 in the post.
0 |
Component | UE - Simulation - Physics |
---|---|
Affects Versions | 5.5.3 |
Target Fix | 5.6 |
Created | Feb 27, 2025 |
---|---|
Updated | Mar 3, 2025 |