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

**URL:** <https://forums.unrealengine.com/t/oncomponentendoverlap-does-not-provide-the-same-information-as-oncomponentbeginoverlap/342515>\
**Category:** World Creation\
**Tags:** oncomponentbeginover, unreal-engine, Collision, question\
**Created:** [December 27, 2015, 4:26pm UTC](https://forums.unrealengine.com/t/oncomponentendoverlap-does-not-provide-the-same-information-as-oncomponentbeginoverlap/342515 "2015-12-27T16:26:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_44ea4ec1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_44ea4ec1](https://forums.unrealengine.com/u/anonymous_user_44ea4ec1)\
**Post date:** [December 27, 2015, 4:26pm UTC](https://forums.unrealengine.com/t/oncomponentendoverlap-does-not-provide-the-same-information-as-oncomponentbeginoverlap/342515/1 "2015-12-27T16:26:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a0dfe1c61](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a0dfe1c61](https://forums.unrealengine.com/u/anonymous_user_a0dfe1c61)\
**Post date:** [December 28, 2015, 11:07am UTC](https://forums.unrealengine.com/t/oncomponentendoverlap-does-not-provide-the-same-information-as-oncomponentbeginoverlap/342515/2 "2015-12-28T11:07:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_44ea4ec1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_44ea4ec1](https://forums.unrealengine.com/u/anonymous_user_44ea4ec1)\
**Post date:** [December 28, 2015, 2:48pm UTC](https://forums.unrealengine.com/t/oncomponentendoverlap-does-not-provide-the-same-information-as-oncomponentbeginoverlap/342515/3 "2015-12-28T14:48:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a0dfe1c61](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a0dfe1c61](https://forums.unrealengine.com/u/anonymous_user_a0dfe1c61)\
**Post date:** [December 29, 2015, 12:00am UTC](https://forums.unrealengine.com/t/oncomponentendoverlap-does-not-provide-the-same-information-as-oncomponentbeginoverlap/342515/4 "2015-12-29T00:00:54Z")

</div>

What is wrong with the OtherActor and OtherComponent variables?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_44ea4ec1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_44ea4ec1](https://forums.unrealengine.com/u/anonymous_user_44ea4ec1)\
**Post date:** [December 29, 2015, 3:05pm UTC](https://forums.unrealengine.com/t/oncomponentendoverlap-does-not-provide-the-same-information-as-oncomponentbeginoverlap/342515/5 "2015-12-29T15:05:49Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a0dfe1c61](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a0dfe1c61](https://forums.unrealengine.com/u/anonymous_user_a0dfe1c61)\
**Post date:** [December 30, 2015, 1:20am UTC](https://forums.unrealengine.com/t/oncomponentendoverlap-does-not-provide-the-same-information-as-oncomponentbeginoverlap/342515/6 "2015-12-30T01:20:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_44ea4ec1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_44ea4ec1](https://forums.unrealengine.com/u/anonymous_user_44ea4ec1)\
**Post date:** [December 30, 2015, 6:19pm UTC](https://forums.unrealengine.com/t/oncomponentendoverlap-does-not-provide-the-same-information-as-oncomponentbeginoverlap/342515/7 "2015-12-30T18:19:36Z")

</div>

Thank you.  
I posted bug report.

> **[Provide FHitResult SweepResult in OnComponentEndOverlap()](https://forums.unrealengine.com/questions/353265/provide-fhitresult-sweepresult-in-oncomponentendov.html)**
>
> Please provide FHitResult SweepResult in OnComponentEndOverlap() similar to OnComponentBeginOverlap(). SweepResult.Component.Get() and SweepResult.Item allow to get instance index for UHierarchicalInstancedStaticMeshComponent or...

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [December 31, 2015, 1:56pm UTC](https://forums.unrealengine.com/t/oncomponentendoverlap-does-not-provide-the-same-information-as-oncomponentbeginoverlap/342515/8 "2015-12-31T13:56:38Z")

</div>

Hey -

As mentioned on the other post you created ([Provide FHitResult SweepResult in OnComponentEndOverlap() - Programming & Scripting - Epic Developer Community Forums](https://answers.unrealengine.com/questions/353265/provide-fhitresult-sweepresult-in-oncomponentendov.html)), a feature request for this functionality has been entered for consideration.

Cheers
