x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 solutionalt text

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 !

Product Version: UE 4.20
Tags:
a.png (958.5 kB)
more ▼

asked Nov 09 '18 at 01:36 PM in Blueprint Scripting

avatar image

beckk974
12 1 1 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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?

alt text

capture.png (166.5 kB)
more ▼

answered Nov 09 '18 at 02:41 PM

avatar image

ThompsonN13
10.1k 33 10 24

avatar image beckk974 Nov 09 '18 at 02:50 PM

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 ?

avatar image ThompsonN13 Nov 09 '18 at 04:25 PM

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.

avatar image beckk974 Nov 09 '18 at 02:50 PM

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

avatar image HarryHighDef Nov 09 '18 at 02:52 PM

Got the screenshots in before me. :) 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.

avatar image beckk974 Nov 09 '18 at 03:01 PM

Event without the "look at " function, i tried what you propose but it doesn't seems to workalt text

It's like the blueprint thinks there is something between us even if there not :/

a.png (96.0 kB)
aa.png (1.4 MB)
avatar image HarryHighDef Nov 09 '18 at 03:06 PM

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.

avatar image beckk974 Nov 09 '18 at 03:16 PM

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 :)

avatar image HarryHighDef Nov 09 '18 at 03:29 PM

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.

avatar image ThompsonN13 Nov 09 '18 at 04:28 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Nov 09 '18 at 02:33 PM

avatar image

HarryHighDef
1.4k 1 14 17

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question