Problem with Line Trace and Instanced Static Mesh Components. The first attempt fails

I have a weird problem with lineTraces and instances mesh components. I will try to explain the best I can…

I have a function which perform a single linetrace againts an instanced mesh component in order to delete the specific instance hit.

This function is called inside a loop and its working fine except for the first time. The algorithm is called at the BeginPlay event but I’ve used a timer as well to check whether is a problem about the creation order (instanced meshes are not ready when I do the linetrace or whatever…). it didn’t work either even few seconds after the game started.

The rest of the iterations are working properly. The only which is failing is the first one but if I call again that function on this element after the “main” loop it works this time.
So, it don’t seems a problem with this specific element, just that something is happening with the physics engine the first time.

Did you face something similar?? any idea or advice??


Just to add some info:

I’m drawing debug lines for each line trace and it seems clearly that it should hit but it doesn’t (the first attempt).


I have the same issue when creating Terrain with Instanced Static Meshes. I want to place some trees but the line traces go through the Instanced Mesh.
As this Question is a long time ago, did you find any solution?

I’m noticing this too - foot IK using line traces is not working on instanced static meshes.

This is an old post, but comes up high on google results for this issue:

If you are doing a trace against an Instance Static Mesh you should check if “btracecomplex” is set to true. if it is, the trace is going to fail. Set it to false, and the trace should succeed, assuming everything else is set up correctly.