how to determine a colliding actor class

Hi everyone!

Some times ago I created this little blueprint to allow my character to eat some fruit along a level. When colliding with another actor, the blueprint would play a sound, destroy the other actor, and call a function to increase a counter. All worked fine, until I added other kind of actors in the scene. Now this blueprint do its job no matter what is the actor colliding with my character.

&stc=1&d=1435054754

So, I think I could create a branch and depending on what kind of class the colliding actor belongs to, execute the blueprint or not… problem is, I am having trouble to get the colliding object class and connect it to the branch node… This was my idea.

Can someone help me with this please? How do I determine the class of the colliding actor? Or maybe you have another, better way, to solve this problem?

Thanks in advance for your help! :slight_smile:

From the Other Actor on the component hit/overlap node, you could cast it to a class, if it fails, try casting to another, if it fails, cast to another, and so on. Eventually it should work on something.
It will pretty much work the same as your branch idea. Not sure if it’s the most efficient way though.

You could also create a custom object response for certain things, that way, only collision with certain objects could trigger it.

Thank you bogieman! I think I solved it in another way, more similar to my original idea. However, your link is very useful! :slight_smile:

Looks like posting on the forum is a really good way to discover a solution on my own shortly after :smiley:

Here is how I did it.

&stc=1&d=1435057665

Np and oddly enough it is, I think it’s more just writing down what you’re trying to do makes it clearer.