On Component Begin Overlap doesn't work

I made a trench and some other sections, but this one is giving me hours of stress. I want that when a troop gets close to a trench, he automatically stays there, and i actually have the code i need, but i don’t know how to cast from trench to troop (and viceversa) to send the functions. How i do that? The trench is a actor with a box collision on it to detect the troops and the troop is just a character with default settings, including the generate overlap events enabled.

Hey there @R0YITO! Welcome back! There’s tons of ways to communicate back and forth between actors! Personally for things like this I tend to use either event dispatchers or blueprint interfaces. I’ll leave some resources here first, and then ask some questions about how your collisions are.

Actor Communication Overview: Actor Communication | Unreal Engine 4.27 Documentation

Personally this seems like a great time to use blueprint interfaces. Can make a general interface like Enter Cover and have the logic tell the soldiers if there’s space or not and what position to go to.

Interace Documentation: Interface Quick Start Guide | Unreal Engine 4.27 Documentation


So in your collisions, you had said you had generate overlaps on right? The question is does the trench have a collider for the troops to detect? If so, may I see it’s settings and your blueprint?

1 Like

Hi, sorry for the late reply. I fixed this days ago, i just used the on component being overlap event to fire custom events inside the troop (overlapping actor). thanks anyways!

edit: i checked the actor communication overview link you sent, and it had helpful content for me, thanks, i’ll mark it as answer.

2 Likes