When using Weld Simulated Bodies enabled AttachToComponent func, the child Primitive Component's BodyIstance ActorHandle is released. As a result, in BodyInstance.cpp, the judgment of FPhysicsCommand :: ExecuteWrite (ActorHandle, [&] (const FPhysicsActorHandle & Actor) is flipped , and because UpdatePhysicalMaterials does not work, SetPhysMaterialOverride does not function properly.
You should be able to fix this issue by modifying UpdatePhysicalMaterials as follows:
void FBodyInstance::UpdatePhysicalMaterials() { SCOPE_CYCLE_COUNTER(STAT_UpdatePhysMats); UPhysicalMaterial* SimplePhysMat = GetSimplePhysicalMaterial(); TArray<UPhysicalMaterial*> ComplexPhysMats = GetComplexPhysicalMaterials(); //FPhysicsCommand::ExecuteWrite(ActorHandle, [&](const FPhysicsActorHandle& Actor) FPhysicsCommand::ExecuteWrite(GetActorReferenceWithWelding(), [&](const FPhysicsActorHandle& Actor) { ApplyMaterialToInstanceShapes_AssumesLocked(SimplePhysMat, ComplexPhysMats); }); }
expect :The box slides in a few seconds
result : The box does NOT slide.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-74239 in the post.
2 |
Component | UE - Simulation - Physics |
---|---|
Affects Versions | 4.22, 4.21.2 |
Target Fix | 4.23 |
Fix Commit | 6544780 |
---|---|
Main Commit | 6903163 |
Created | May 7, 2019 |
---|---|
Resolved | May 17, 2019 |
Updated | Jun 12, 2019 |