x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: UE 4.9
Tags:
more ▼

asked Dec 27 '15 at 04:26 PM in C++ Programming

avatar image

PhoenixFalcon
11 1 5 7

avatar image AidoP Dec 28 '15 at 11:07 AM

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.

avatar image PhoenixFalcon Dec 28 '15 at 02:48 PM

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.

avatar image AidoP Dec 29 '15 at 12:00 AM

What is wrong with the OtherActor and OtherComponent variables?

avatar image PhoenixFalcon Dec 29 '15 at 03:05 PM

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 :-)

avatar image AidoP Dec 30 '15 at 01:20 AM

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.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hey PhoenixFalcon -

As mentioned on the other post you created (https://answers.unrealengine.com/questions/353265/provide-fhitresult-sweepresult-in-oncomponentendov.html), a feature request for this functionality has been entered for consideration.

Cheers

Doug Wilson

more ▼

answered Dec 31 '15 at 01:56 PM

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question