How to block a box collision with a wall ?
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 !
asked Nov 09 '18 at 01:36 PM in Blueprint Scripting
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?
answered Nov 09 '18 at 02:41 PM
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.
answered Nov 09 '18 at 02:33 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here