Announcement

Collapse
No announcement yet.

how to determine a colliding actor class

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.



    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!

    #2
    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.
    https://docs.unrealengine.com/latest...ion/index.html
    YouTube Playlist of W.I.P game project - https://www.youtube.com/playlist?lis...XCXMLFckHVo_bV (May contain swearing, I'm Irish :P)

    Comment


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

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

      Here is how I did it.

      Comment


        #4
        Np and oddly enough it is, I think it's more just writing down what you're trying to do makes it clearer.
        YouTube Playlist of W.I.P game project - https://www.youtube.com/playlist?lis...XCXMLFckHVo_bV (May contain swearing, I'm Irish :P)

        Comment

        Working...
        X