Changing an instanced object's collision type at run-time does not affect LineTraceForObjects

This issue is happening on UE 4.13, and is currently driving me mad!

Workflow is quite simple:

  1. Hierarchical Instanced Static Mesh is spawned when level is loaded, with a static mesh and set object type to “SelectableFloors”.
  2. Left Click Mouse Button starts a LineTraceForObjects with the correct object type “SelectableFloors” in array > Everything works as expected, and the hierarchical instanced mesh is hit correctly (I can then grab the instance number from the hit results)
  3. Button “Page Down” sets said Hierarchical Instanced Static Mesh (and therefore all its instances) to ObjectType “WorldDynamic” and then set visibility to 0
  4. Left Click Mouse button still hits the now-invisible instance, despite it being set to “WorldDynamic” and not “SelectableFloors”. What’s funny is that if I grab the component’s object type directly from the HitResult, it does says “WorldDynamic”, so it definitely should have been ignored by the LineTraceForObjects set to “SelectableFloors” only.

Note that the same issue occurs if I use a custom trace channel instead of an object type. When I adapt the blueprint to trace channels rather than object type, the changed instance hit by the trace says that the same channel that it is looking for is set to “Ignore”.

Has anyone else encountered this issue? Somehow It looks like the data used by the LineTrace does not get updated if I change the collision object type or channel visibility at run-time.

Thanks for any assistance anyone could provide! I’d be very grateful!

Kind Regards,
Quentin

For now I have resolved the issue by using MultiLineTraceForObjects, setting “SelectableFloors” to “overlap” and manually checking the visibility of each hit.

However, it still doesn’t explain why updating object type or channel’s parameters does not affect LineTrace at all!

I can put together a sample project if needed, I’ll try to do it as soon as I find the time.

This old post just saved me probably an entire day of research. It’s UE5.3 and I was going mad about it as I called the node from HISM to “Set collision Object Type” It technically updates it, as I can get the updated enum data from the HISM. However, the old collision type persists when line tracing or getting mouse hit results. It is such a disappointment.
Funny enough there is a super simple workaround. Just switch Off and On the collision of the HISM in one line of code and it will update properly.

1 Like