BoxCollison's OnComponentHit event is not triggered when BoxCollison hits a spawned actor with simulate physics enabled. The event is triggered if the same actor has been placed in the level beforehand.
Workaround Code in UE5.1
PhysScene_Chaos.cpp FPhysScene_Chaos::HandleCollisionEvents(const Chaos::FCollisionEventData& Event) // Get swapped velocity deltas const FVector& DeltaVelocity1 = bSwapOrder ? CollisionDataItem.DeltaVelocity2 : CollisionDataItem.DeltaVelocity1; const FVector& DeltaVelocity2 = bSwapOrder ? CollisionDataItem.DeltaVelocity1 : CollisionDataItem.DeltaVelocity2; NotifyInfo.Info0.SetFrom(GetBodyInstanceFromProxyAndShape(PhysicsProxy0, bSwapOrder ? CollisionDataItem.ShapeIndex2 : CollisionDataItem.ShapeIndex1), DeltaVelocity1); NotifyInfo.Info1.SetFrom(GetBodyInstanceFromProxyAndShape(PhysicsProxy1, bSwapOrder ? CollisionDataItem.ShapeIndex1 : CollisionDataItem.ShapeIndex2), DeltaVelocity2);
1. Open attached project.
2. The vehicle moves forward and collides with a "Spawned" Box.
Both box and car detected OnComponentHit event and logged.
3. The vehicle moves forward and collides with a "Placed" Box.
The box detects OnComponentHit event and logs, but the car does not detect the OnComponentHit.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-177833 in the post.
4 |
Component | UE - Simulation - Physics |
---|---|
Affects Versions | 5.1 |
Target Fix | 5.6 |
Created | Feb 20, 2023 |
---|---|
Updated | Oct 25, 2024 |