How to block a box collision with a wall?

Hi !

I have a little problem with my “security camera” system and couldn’t find out the solution

I have my camera rotating with a capsule collision and detect me when it saw me. However, I want this “capsule collision” to be block once the character is hiding behind a wall.

I’ve made the to "BlockAll"collision preset but it didn’t change anything. If someone have the answer, thank you !

You should have the camera fire off a ray trace when it detects the player. If the trace reaches the player the camera can see them but if it doesn’t then an object is blocking its line of sight.

what your trying to do is impossible, it would require you to change the basic shape of the collision. there is however a way to accomplish what your looking to do but with another method. now im assuming you want when the camera sees the player then it does something right? if thats the case you just need to add another check in to see if the player is visible via a line trace.

ok so in the example below we first need to detect if there is a overlap of the sight volume (on begin overlap), then we need to see if it was the player character that overlapped (get player character → equal → branch), next we need to determine if there is anything in between the camera and the player (line trace from camera to player location), then if theres no hit we know there was nothing between the camera and the player (return value, branch).

this entire script basically asks two questions: is the player in range? and is there anything between me and the player?

Thank you for your response it kind of work ( the last branch it’s true and not false right if something collapse then the alarm is on ?)

Another little problem if : if my alarm detect my player and then i’m hiding behind the wall, it’s still work no ?

I forgot to precise that once i get “seen” the camera make a look at rotation and follow the player

Got the screenshots in before me. :slight_smile:
Another thing to consider may be taking the hit location from the sweep so you can aim your trace at the correct bit of the body.

Check the trace results, You are likely hitting the wall or a large actor in your world.

You can break the results and print the location and name of what you hit.

Event without the "look at " function, i tried what you propose but it doesn’t seems to work

It’s like the blueprint thinks there is something between us even if there not :confused:

It was something like that indeed thank you !

Last problem is still if the camera detect me and follow me behind a wall i’m still “detected” because I never declenched the “OnEndOverlap” since the camera always look at me.

Is there a solution like don’t use the capsule collision but only the raycast ? it would be simpler maybe with “CapsuleByChannel” thing ?

Than,k you a lot to take some time for me :slight_smile:

You may need to do a raytrace on a timer to check if the player has become obscured and stop the camera from tracking you.

its difficult to understand what your trying to say. the last branch should be false if there was nothing between the camera and the player. the return value bool basically tells you if there was a hit between the start and end points, or put another way was there something between the two.

yea you could totally do a trace on a timer to confirm if the player is still detected. i wasnt sure on the complete context so i just focused on the main issue of the question which was eliminating detection when behind a wall.