Description

A Simulating Physics component with StartAwake = false will be awoken by a Welded component
If a welding occurs during the call to OnCreatePhysicsState, this breaks the start awake disabled flag. This is due to a call to UpdatePhysicsFilterData(), which force a WakeUp call to the body.
The expected result would be that the welding would not interfere if the parent component is sleeping or not.
I've also identified that if the child component is set to SimulatePhysics and StartAwake true, the parent will also wake up.
My suggested workaround involved calling ResetPhysicsState() on the parent component, that way it returns to the initial state and the behavior is as expected: it is not awoken.
The licensee added:
I still believe the best optimal solution is to not call this WakeUp within UpdatePhysicsFilterData.
In fact, I was thinking of a generic approach, where any call to UpdatePhysicsFilterData should not wakeup the object, unless this is explicitly required by the caller.
Most of the time, the filter data changes don't need to wakeup the body, as this is most of the time applied at init and not at runtime.
I'm thinking about changing this, maybe checking the bStartAwake flag as a safe guard.
For instance, in FBodyInstance::UpdatePhysicsFilterData:
if(bStartAwake)

{ // Always wake actors up when collision filters change FPhysicsInterface::WakeUp_AssumesLocked(Actor); }
Steps to Reproduce

In a clean Blueprint (BP) project, create a BP
In the BP, add a Static Mesh component (SMC), set it as RootComponent, set it as Mobility: Movable, set SimulatePhysics: true, confirm EnableGravity: true.
In the SMC, set StartAwake: false - this will make the SMC be in a sleeping state whenever the game starts.
The expected result would be that Welding would not wake a parent component.
Not required, but at this point you can spawn the BP above ground and Play-In-Editor (PIE) to verify it does not fall.
Add another SMC (SMC2) as a child of the first SMC.
Set SMC2 SimulatePhysics: false, check that AutoWeld: true.
If we PIE now we can see that both SMC will fall to the ground - the Welding is waking the parent component.

Callstack

UnrealEditor-PhysicsCore.dll!Chaos::TPBDRigidParticle<double,3>::SetObjectState(const Chaos::EObjectStateType InState, bool bAllowEvents, bool bInvalidate) Line 3592 C++
UnrealEditor-PhysicsCore.dll!`Chaos::TThreadedSingleParticlePhysicsProxyBase<1>::SetObjectStateBase'::`2'::<lambda_1>::operator()<Chaos::TGeometryParticle<double,3>>(Chaos::TGeometryParticle<double,3> * Ptr) Line 950 C++
UnrealEditor-PhysicsCore.dll!Chaos::TThreadedSingleParticlePhysicsProxyBase<1>::Write<`Chaos::TThreadedSingleParticlePhysicsProxyBase<1>::SetObjectStateBase'::`2'::<lambda_1>>(const Chaos::TThreadedSingleParticlePhysicsProxyBase<1>::SetObjectStateBase::__l2::<lambda_1> & Lambda) Line 1015 C++
UnrealEditor-PhysicsCore.dll!Chaos::FRigidBodyHandle_External::SetObjectState(const Chaos::EObjectStateType InState, bool bAllowEvents, bool bInvalidate) Line 1128 C++
UnrealEditor-PhysicsCore.dll!FChaosEngineInterface::WakeUp_AssumesLocked(Chaos::FSingleParticlePhysicsProxy * const & InActorReference) Line 478 C++
UnrealEditor-Engine.dll!FBodyInstance::UpdatePhysicsFilterData::__l2::<lambda_1>::operator()(Chaos::FSingleParticlePhysicsProxy * const & Actor) Line 1100 C++
[Inline Frame] UnrealEditor-Engine.dll!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::FFunctionRefStoragePolicy,void __cdecl(Chaos::FSingleParticlePhysicsProxy * const &)>::operator()(Chaos::FSingleParticlePhysicsProxy * const &) Line 555 C++
UnrealEditor-Engine.dll!FPhysInterface_Chaos::ExecuteWrite(Chaos::FSingleParticlePhysicsProxy * const & InActorReference, TFunctionRef<void __cdecl(Chaos::FSingleParticlePhysicsProxy * const &)> InCallable) Line 597 C++
> UnrealEditor-Engine.dll!FBodyInstance::UpdatePhysicsFilterData() Line 1103 C++
[Inline Frame] UnrealEditor-Engine.dll!FBodyInstance::PostShapeChange() Line 1852 C++
UnrealEditor-Engine.dll!FBodyInstance::Weld::__l2::<lambda_1>::operator()(Chaos::FSingleParticlePhysicsProxy * const & Actor) Line 1788 C++
[Inline Frame] UnrealEditor-Engine.dll!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::FFunctionRefStoragePolicy,void __cdecl(Chaos::FSingleParticlePhysicsProxy * &)>::operator()(Chaos::FSingleParticlePhysicsProxy * &) Line 555 C++
UnrealEditor-Engine.dll!FPhysInterface_Chaos::ExecuteWrite(Chaos::FSingleParticlePhysicsProxy * & InActorReference, TFunctionRef<void __cdecl(Chaos::FSingleParticlePhysicsProxy * &)> InCallable) Line 608 C++
UnrealEditor-Engine.dll!FBodyInstance::Weld(FBodyInstance * TheirBody, const UE::Math::TTransform<double> & TheirTM) Line 1794 C++
UnrealEditor-Engine.dll!UPrimitiveComponent::WeldToImplementation(USceneComponent * InParent, FName ParentSocketName, bool bWeldSimulatedChild, bool bWeldToKinematicParent) Line 919 C++
UnrealEditor-Engine.dll!FInitBodiesHelperBase::CreateShapesAndActors() Line 1407 C++
UnrealEditor-Engine.dll!FInitBodiesHelperBase::InitBodies() Line 1476 C++
UnrealEditor-Engine.dll!FBodyInstance::InitBody(UBodySetup * Setup, const UE::Math::TTransform<double> & Transform, UPrimitiveComponent * PrimComp, FPhysScene_Chaos * InRBScene, const FInitBodySpawnParams & SpawnParams) Line 1628 C++
[Inline Frame] UnrealEditor-Engine.dll!FBodyInstance::InitBody(UBodySetup * InRBScene, const UE::Math::TTransform<double> &) Line 656 C++
UnrealEditor-Engine.dll!UPrimitiveComponent::OnCreatePhysicsState() Line 934 C++
UnrealEditor-Engine.dll!UStaticMeshComponent::OnCreatePhysicsState() Line 819 C++

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-237599 in the post.

0
Login to Vote

Unresolved
ComponentUE - Simulation - Physics
Affects Versions5.4.4
Target Fix5.6
CreatedJan 10, 2025
UpdatedJan 28, 2025
View Jira Issue