How to get the index of an instance hit within a HISM component.

When a hit or overlap occurs in HISM, is it possible to retrieve the instance’s index without relying on external dependencies?

There are countless causes for a hit, so all i need to do is identify that a hit occurred and which instance it was on.

On component hit(overlap) ->sweep result → break hit result → “Hit item” is returning the index of an instance. I would advise to check weather the “hit item” is (> -1) when checking. They changed something in engine and reading this is somewhat unreliable now for some reason.

Cast (Hit Component) to InstancedStaticMeshComponent … On success check Hit Item is > -1.

You’ll need the ISM ref anyway to do anything with it.

First thing is to check if its >-1, then immediately store that value to a temporary integer variable. And use this temporary variable instead of “hit item”, because you have to cast to an actor this HISM hit or overlapped and do other things in this execution line. My guess is that “hit item” value can change somehow even if you use it while you are in the same execution line. They changed something and now it is inconsistent.

Hit Item always returns a positive number.However, this is the index of the physics asset body of the skeletal mesh that hit HISM, and this value is not needed.

Also, it’s possible to obtain the HISM instance index from the skeletal mesh’s hit events, this isn’t what I want to do either.

What I need is to get the index of the HISM instance from the HISM hit event.Out of the countless instances, we need to identify which instance actually received the hit.

Doing this through an interface from an external object is cumbersome, and some objects simply cannot implement interfaces in the first place.It would be best if HISM itself could recognize which instance it received a hit from.

You would need to have HISM component of a blueprint. Than you can select that HISM mesh component and click "on component hit( begin overlap ) ". Basically , HISM should be in an actor blueprint. Then you can access it. Maybe there is another way, but this is the only one I know. Also, store the value of “hit item” to a temporary variable first and then check if this temporary variable is >-1 . Then you can use this temporary variable instead of “hit item”. This is better.

I can do traces or collision overlaps on HISMs including painted foliage without any issues with Hit Item.

Can you get the index of an instance that was hit/overlapped. If yes, then this is what he is asking for.

You need the hit notification from the HISM, not from the pawn.

When the hit notification is from the pawn, the hit index is related to the pawn; when the hit notification is from the HISM, the hit index is the instance index.

If you only have the pawn hit event, and you want to take different actions depending on what’s hit, I would tech the static meshes being instanced with physics materials that depend what the hit should do.

If that’s still not good enough, then you can get the impact point, and run an additional small sphere test against the HISM centered on that point. You will get a hit result back that is related to the HISM, and where the hit index is the instance index.

Is it best for HISM to trace itself at this point?Honestly, I think this should be easier to do by default.