Hit Result Hit Item returns -1 on FoliageInstancedStaticMeshComponent

Hello,

I have a few levels which are created with a lot of foliage, which will have interactive behavior using Skeletal Meshes and Physics Assets.
I need to remove an instance on the InstancedFoliageActor1 so I can replace it with an Actor blueprint with a Skeletal Mesh as its component.
I ran into a problem where I can not seem to retrieve an instance’s transform using a Hit Result’s Hit Item. That Hit Item parameter returns -1. To test whether or not the InstancedFoliageActor1 exists I figured I would call Get Instance Count on the overlapping component which returns the correct amount of instances.

I would like to know how to solve that preferably without losing the Foliage Brush capabilities.

Supplied screenshot shows that the InstancedFoliageActor1 is not known to the World Outliner.
Also shows that the Transform of the instance is wrong, or atleast invalid.

Did you ever solve this? I am stuck with the exact same desired outcome and problem under 4.17.

The solution I found to work was that I had to create a separate collision channel for the foliage and set the collision channel in the foliage type, the brush used with the foliage painter. If that does not help, double check if your mesh has a collision mesh set up properly.

Have a great 2019!

Sincere thanks. Unfortunately it appears I have one critical difference which may be interfering - I am not using physics, only query, and thus must use On Overlap which does not return a valid Hit Result (and therefore no way to derive the instance index). I can line trace and correctly get the index but cannot get it via On Overlap Event. Unless I am mistaken, you are using the hit result from an On Hit event, correct?

Elsewhere online I have only seen a recommendation of line tracing after On Overlap fires, but that would be far too heavy as I am attempting to make individually cuttable (on overlap with sword) foliage-tool-placed grass. I have also read that it could be possible to enable physics but eliminate any physics calculations, thereby enabling On Hit events, but I’m doubtful about this “hacky” method being worth pursuing.

The struggle continues.

I have found a workaround to fit my use case. To reiterate: I am not using physics collision so I cannot rely on On Hit events and must use On Begin Overlap. Because On Component Begin Overlap does not populate most of the Sweep Result struct, but I want to fire the function based on this Overlap, I was left working around it.

In the few other threads I could find discussing this, one potential solution mentioned was using On Overlap to fire one or more traces of your choosing and then derive information from that. One user mentioned an alternative to this: take On Component Begin Overlap, plug Other Comp into the Cast To for your item, then plug the output pin of your Cast into the node Get Instances Overlapping Box, which outputs an Array that can be used to as references to the overlapped instances; used for instance-related node inputs such as the Instance Index input of the Remove Instance node.

The ‘Box’ is a struct of two 3D vectors, each representing the opposite corners of the box in 3D space.

It’s unfortunate that On Overlap’s Sweep Result struct isn’t at least a bit more useful.