Get overlapping index of Hierarchical instanced static mesh

I was wondering if there was a way I could get an instance index from a “OnComponentBeginOverlap” event?

I’m trying to detect when a player is overlapping a item on a shelf and if it is, then pick it up. I’m using a HISM because there will be a lot of items so I need to optimize it.

Hi, break the hit result from the “Sweep Result” of the on component begin overlap.

I’m not 100% sure tough that the hit result from the on component begin overlap contains a valid “Hit Item” (as far as I know it has less valid outputs than a hit from a trace).

If the “Hit Item” from the on component begin overlap is not valid, you could do a multi line trace for objects and loop through the results until you get the one the on component begin overlap has returned and get the “Hit Item” from there.

2 Likes

I tried breaking the hit result, and it just returns -1. Constantly line tracing would just defeat the point of using a HISM

Set “Multi Body Overlap” on the Collision settings of the HISM to true and the Hit Item will return the instance index.

2 Likes

Yes, that works. The other body index will return the instance index as well. So no need to break Sweep result

1 Like

Thank you. I was stuck on this for ages.

1 Like

for anyone might have same mistake like me,
the overlap event should be in another component, not in instance component.
well it was obvious one but just in the case there are someone like me haha.

1 Like