how to check if an actor is inside the trigger but not the player

I am trying to implement a logic where I shoot balls at 9 trash cans to make fall over the edge. I want to check if all the trashcans has fallen over the edge or not.


This is the level editor.

I have the player on one end and the trash bins on the other end. As you can also see on the top, I have an actor class for the cannonballs and also an actor class for the trash can and the trash cans are all placed using that actor calls. the only stuff of code is in the level blueprint to shoot balls on pressing space. the event graphs of the trigger box, trash cans and the cannon balls are empty. The aim is want to achieve is that i shoot 5 balls and the player all the 9 trash cans into oblivion. I logic i was thinking was by placing a trigger box where the trash cans are and using a counter and decrementing it every time 1 trash can leaves the trigger area. I tried few things but still cannot achieve this.

Inside your BP_TriggerBox, on the end overlap of your collider, check whether you’re overlapping any trash cans. You could keep track, but this is cleaner and doesn’t require a variable.

image

I tried to use your advice but idk if I am doing something wrong.

This is the blueprint inside the trigger box. Also I have placed Trigger Box in the level. Should I instead place a trigger volume? Also your components inside the trigger box looks different as I have something called sprite component.

I have set the duration of the print string to 10 as to not miss the string and set the ball ammo to 10 have more than enough balls to knock all the bins off the edge. Even after knocking them all off the edge and out of the trigger box, no message appears on screen. I might be doing something wrong.

Let me know if you want screenshots of anything else.

I didn’t realize you were using an actual triggerbox derived class- that’s why it’s different.

Lead off of your end overlap event with a print node. If this doesn’t fire, you likely have the wrong collision settings on your trash can.

1 Like

Forget to turn on the collision for the trash cans. Your solution works like charm now

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.