SplineMeshComponent collision breaks if the component moves independently of its actor

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:

  1. 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

  2. Get overlapping actors/components does not consistently return actors/components that the spline mesh is visually clearly overlapping

  3. The spline mesh component’s collision has holes where overlap events should occur but don’t

  4. (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.

Hi Morat,

Sorry for the delay.

Could you try testing this in the latest 4.15.1 build of the engine? There was some changes made to spline mesh component collision (specifically JIRA UE-39212) and if very possible this issue has already been fixed.

Cheers,

TJ

Hi TJ

Apologies for not getting back to you sooner, I was refactoring motion controls for the affected component and couldn’t re-test.

I’ve updated to 4.15.1 and this issue still exists. The workaround is still effective in tackling it.

Hi Morat,

Sorry for the delay.

I’m having trouble getting the overlap issue you described to reproduce. Would you be able to create a new test project that has the issue and upload it here?

Hi there

I’m not sure, it might take me a while to get that together.

I’ll be on the lookout for other reports of this but in the meantime I’ll resolve this post for tracking purposes. When you have time to dig into this more, just post a comment back here to reopen the post.

Hello,

I know this is a very old threat but the issue still persists with inconsistent overlap detection with spline meshes. I have a simple class that builds the spline mesh using the mouse coordinates as the EndPoint and it has trouble recognizing any overlap with a simple box collision.

The workaround posted above or anything that moves the actor even by 0.1 makes it work properly.

Currently on 4.24

Push, this still persists in UE5, or does anyone found a solution for that?