OnComponentEndOverlap() does not provide the same information as OnComponentBeginOverlap()

Hi,

I have a level defined by square cells. Each cell type is represented using UHierarchicalInstancedStaticMeshComponent.
Player character can destroy cells. It is possible to determine particular cell in OnComponentBeginOverlap() event because there is FHitResult SweepResult structure.
SweepResult.Component.Get() returns MeshComponent. SweepResult.Item allows to get individual cell instance.
In contrary OnComponentEndOverlap() has no FHitResult parameter. So it is impossible to find out individual cell instance which stopped overlapping with player.
GetOverlapInfos() does not seem to return valuable data. OverlapInfo.Item always -1.

The easiest way to combat this problem will be to store a pointer to the last square that had an overlap begin. Of course, this won’t necessarily work if a new square can begin an overlap, before the last one is ended.

Yes, this is the problem. Player can overlap multiple cells at the same time.
Player does not destroy cells instantly. Each cell has some “health”.
Currently I am thinking about replacing cell that is about to be destroyed by regular static mesh component. There will be limited set of such components.

What is wrong with the OtherActor and OtherComponent variables?

How do they help to find instance index for InstancedStaticMeshComponent? Do you say I should handle OnComponentBeginOverlap/OnComponentEndOverlap events for the player? In case OtherBodyIndex has the right value that’ll do :slight_smile:

Oh right, that would only work on an array of actors or components. Try OtherBodyIndex, but I don’t think that will have the right value.

What you first mentioned is probably the best way (I can’t think of anything better).

Also, I had a look at how the begin and end overlaps work, and it appears that they should both be able to be able to return a sweep result. Maybe you should report a bug on this.

Thank you.
I posted bug report.

Hey -

As mentioned on the other post you created (Provide FHitResult SweepResult in OnComponentEndOverlap() - Programming & Scripting - Epic Developer Community Forums), a feature request for this functionality has been entered for consideration.

Cheers