Do action only when a specific blueprint overlaps

Hello!

I’m trying to create a 2d sidescroller using paper2d and i’ve encountered a problem:

Say I shoot a spike. I want that spike to disappear only if I shoot it;If i touch it with my character then it should stay visible and still hurt me.

With OnComponentBeginOverlap i’ve been able to only hurt my character or only make the spike dissapear,but not both.

How am i supposed to do that?

The character, the shot and the spike are all blueprints

You can cast the different types of Hit Actors/Components, so for your Character you cast to that and do your functionality and for your weapon/projectile (or whatever hits when you fire) you cast to that and do the disappearing code.

I don’t quite understand what you mean by casting different types of Hit Actors/Components.

I’m still trying to learn Unreal Engine,so if you could elaborate on that I would be very thankful.

On your overlap event you get the Other Actor output. If you hook that up to a cast node, you can essentially ask “is the thing that just touched me a bullet?” Then you can execute your bullet logic from there. If the cast fails, you know it wasn’t a bullet, you can then cast to the player, check if it was him and execute different logic from there:

Well there you go someone explained it for me, thanks :slight_smile:

Basically though this stuff is all very well documented, if you were to type cast to into your context menu it’ll popup with options on which class.

A simple search on “casting unreal engine 4 blueprints” yielded this link as the first hit. Not trying to be rude, there is alot of information out there and I did give you the terminology you needed to get the job done.

Oh,I tried it without the IsValid and it didn’t work.

Thanks for helping me out,now it works like it should.