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"

Dont fire ActorEndOverlap event if actor stop move

Hi everyone

The context : I try to manage the distance of displaying some informations. I have a map with some actors and widget in this.In my pawn, i have a collision sphere, represent the max distance to display widget. On my actor in my map, i have a ActorBeginOverlap fired when the collision sphere of the pawn overlap this actor. This part work fine.

The Problem : The problem is, when the pawn stop move (for stay near the actor) the event ActorEndOverlapis fired. So, the information (widget) disappears and when i move again, the BeginOverlap is fired again. What i want is, the widget dont disappers when the pawn dont move, and disappers only if collision sphere really EndOverlap.

I dont want perform some verification in tick (of actor, or pawn) for check distance (cause i can have many actor at same time).

What is the way to achieve that in easiest way with less ressources ?

Thank you very much.

Product Version: UE 4.21
Tags:
more ▼

asked Feb 18 '19 at 08:05 PM in Blueprint Scripting

avatar image

BigBadWouf
10 2 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Not entirely sure I get it, but I think the problem may be collision detection. To be entirely sure you want to set your sphere as being detected as a unique entity, for example a "vehicle" if you're not using that collision channel. The best way is to create a new collision channel by going into project settings and adding a new collision type.

This is because the issue may be that several types of collisions are being detected. I had the same problem with my characters since they their mesh (pawn), their armor (world dynamic) etc firing the events. Once I set up a custom collision for my sphere and detected only that, everything worked fine.

This is what I use for any kind of end or begin overlap with an interactable sphere that activates text widgets, glow, enemy AI etc:

alt text

more ▼

answered Feb 18 '19 at 09:15 PM

avatar image

Crowley Caine
643 8 9 15

avatar image BigBadWouf Feb 18 '19 at 09:55 PM

Thank you, for informations. That work. I have add new object type collision, I have set my collision sphere to OverlapAllDynamic, and on my actor, Custom collision, ignore all, except for my custom type collision, like in your screenshot and this work, but sometime it's seem unstable.

avatar image BigBadWouf Feb 18 '19 at 10:09 PM

I try some setting in collision but always unstable. Except the first time i have tried. Very weird.

avatar image Crowley Caine Feb 18 '19 at 10:13 PM

It may be that there are still other collisions being detected, for interaction spheres like this you want to ignore everything except the sphere. Make sure you set the same exact settings in both the actor that does the overlap (usually the player) and the actor receiving the overlap (object/ai/etc).

Overlap events are tricky. Especially if the other actor is moving. Be very careful how you set up your code and if necessary use some bools with branches, delay, do-once, etc.

avatar image BigBadWouf Feb 18 '19 at 10:20 PM

Very tricky yeah, after some test, i have set my two actor (pawn and target) with same setting in collision, and ii's work fine.

Collision system it's very ambigus in fact. I need to take the time to study this in more depth.

So, thank you again for your help !

avatar image BigBadWouf Feb 18 '19 at 10:42 PM

So, it's me again... I have tried with many actor, and again the widget disappears. all actor have same setting, with only the detection of sphere collision overlaping. But, again, if i dont move, all disappears :(

I dont know why sometime it's work and sometime no...

avatar image Crowley Caine Feb 18 '19 at 10:43 PM

Gimme a sec I'll show you how mine work

avatar image BigBadWouf Feb 18 '19 at 10:55 PM

I got this result too, but only if my pawn move. When my pawn stop moving, all widget disappears. I have this setting on both actor and pawn

alt text

avatar image Crowley Caine Feb 18 '19 at 10:58 PM

Well that sounds like it is colliding with something that causes it to fire so much that it's constantly triggered. Here's a little cheat for you:

alt text

overlap.png (77.3 kB)
avatar image BigBadWouf Feb 18 '19 at 10:59 PM

!n my actor blueprint alt text

avatar image Crowley Caine Feb 18 '19 at 11:00 PM

Yeah it ensures only the player can trigger it.

avatar image BigBadWouf Feb 18 '19 at 11:02 PM

Yep,i see your post only after i have sent mine

avatar image Crowley Caine Feb 18 '19 at 11:04 PM

Well, you have other actor there so you can still use those branches.

What exactly are you overlapping? You generally want to do that by adding a collision sphere component to your actor and use that for overlap.

avatar image BigBadWouf Feb 18 '19 at 11:05 PM

So, in my map, all other actors have collision set to none, and after check if actor == player pawn, dont resolv the problem :(

avatar image Crowley Caine Feb 18 '19 at 11:07 PM

Ok, here is what my collision detection actually looks like in the level: alt text

So he has an outer sphere to just show his name, and another sphere to bring up the interact message.

spheres.png (1.1 MB)
avatar image BigBadWouf Feb 18 '19 at 11:08 PM

The documentation say "EndOverlap is fired when actor stop move", this is what i try to pass over

avatar image Crowley Caine Feb 18 '19 at 11:09 PM

What are you using to detect the overlap?

avatar image BigBadWouf Feb 18 '19 at 11:12 PM

Sorry for multiple post, i dont refresh the page all time, so, i can miss some reply.

I dont have collision sphere on my actor, but only on my pawn (maybe it's wrong). So, the collision sphere in on my PAWN, and, in my actor, i have "ActorBeginOverlap" node to detect if actor is in Collision sphere.

avatar image Crowley Caine Feb 18 '19 at 11:14 PM

Ok if I get you right you are saying that your enemy/ai or just the non-playable character has the collision sphere, whereas your playable character has the actorbeginoverlap event?

The overlap event should be on your non-playable character that the widget is attached to.

avatar image BigBadWouf Feb 18 '19 at 11:20 PM

No, it's the opposite. My playable pawn has the collision sphere (for managing the distance), and my non playable object, with widget, detect the overlapping

avatar image Crowley Caine Feb 18 '19 at 11:26 PM

You're gonna want to have the collision sphere on the actual non-playable actor. It can be done the way you are doing it, but you'd need to break the hit result, use that to set a target (or most likely add a target to an array) and then work from that. You can use multispheretraceforobjects for the same thing.

Or, you could just add the collision sphere to the non-playable character and have that react to the player entering it. I prefer this, it makes it so much easier since you only ever have to check against a single actor (unless you have some reason for NPC interaction that triggers behavior, but even so there are better ways to do that).

avatar image BigBadWouf Feb 18 '19 at 11:37 PM

I wanted the sphere on the player to be able to manage the distance at which the widget is displayed. And that requires only one sphere.

If I have to put the sphere on the actors, it will quickly become messy because I can have several hundred ...

If the best solution is that, then I would do like that ...

avatar image Crowley Caine Feb 18 '19 at 11:42 PM

Well I understand what you're trying to do. You want your player character to walk around with a sphere and activate stuff as he goes right? Well, for that you would be better off with a blueprint interface and a function in every non-playable character that receives the message from the interface function.

And what happens if you want to activate things at different ranges? Well, your player would need multiple spheres for that and you'd have to turn off the collision on one sphere and activate it for another and it just becomes very difficult from there.

Do that if you want, but I think you'll have far more success with just having the spheres on the actual actors that fire events off the player entering them. This is the beauty of parent-child blueprints: You only have to add it once. Say you have a 100 different NPCs, they all do different things. Well, if you have a master npc blueprint you add the sphere and the collision detection there. And you never have to do it again if you make the NPCs child-classes of that blueprint.

avatar image BigBadWouf Feb 18 '19 at 11:55 PM

I do not absolutely want to do that. But yes, that was my first thought, but I have no problem admitting that it may be the wrong way to go.

Regarding the distance, I just wanted to change the radius of the collision sphere, no need for multiple sphere.

I know the principle of parent / child, it was not in this sense that I said that, but, if I put the sphere on the actor, the engine will have hundreds to manage, instead of one in my first idea.

But I'm probably wrong. I will try the way you described in the first posts.

avatar image Crowley Caine Feb 18 '19 at 11:56 PM

Sphere collisions are actually quite simple, there can be hundreds or thousands to manage, but that is only a problem if they are all fired at the same time. One by one it is not taxing.

Remember, you are sending info between blueprints with the first method here, that is more taxing than detecting a collision.

avatar image BigBadWouf Feb 19 '19 at 12:27 AM

Yeah your right. I moved my collision to my non player actor, and now its work. I'm just little sad cause i cant manage display distance simply without check distance between all actor and player :(

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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