This issue has taken a long time to track down. The symptoms are:
If the actor containing a SplineMeshComponent is transformed then the collision attached to the component is properly updated and matches the actual location of the component. Overlaps are properly calculated with overlapping actors.
If the SplineMeshComponent is moved independently of its actor by calling set start, end etc. followed by update mesh then these issues occur:
-
Get overlapping actors/components often returns actors/components that the spline mesh was overlapping before the move, even if they are clearly no longer overlapping visually
-
Get overlapping actors/components does not consistently return actors/components that the spline mesh is visually clearly overlapping
-
The spline mesh component’s collision has holes where overlap events should occur but don’t
-
(this is what made this hard to track down) When using the ‘show Collision’ console command the collision components of the spline mesh appear to be in the correct place, but the actual collision volumes used for calculation do not match what is shown visually.
The following workaround fixes this issue and is done after calling update mesh:
- Get actor transform
- Set actor transform with +someValue to at least one of the components
- Set actor transform with -someValue to the component
This seems to force the collision to be properly updated because UE4 considers that the actor has moved. It’s necessary to call set actor transform twice because if you just feed in the current values from get actor transform unchanged UE4 ignores it and the collision isn’t updated.
Making the spline mesh the root component has no effect on this issue. I have ‘Use Simple Collisions as Complex’ set on this component as it updates on tick when moving (tracking VR motion controllers) and complex collisions kill the frame-rate.