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"

Hide Multiple Objects With Single Raycast

Good day and thank you for taking the time to help me with this problem I am having.

Goal: So what we are trying to do is dary a ray cast from the camera to the player. Any object that is hit by this raycast will have it's visibilty set to off. This is so the Player can always see their character, and so that the camera is never moved or jerked around without the player.

Issue: So the problem I am having is with multiple objects in front of each other. alt text

What I can have happen is the one of these two walls will turn invisible, but the second one will not. If we rotate the camera it will almost "toggle" between the two, making the new wall hit invisible, and the previous wall visible. Ideally what should happen is when both walls are hit like in the previous image, both walls turn invisible, and not just the first one hit.

This is my current raycast blueprint. alt text

As of right now I am only trying to make a "Wall_BP" Invisible, so this is all I need to currently cast to.

I have tried using the Multi Line Trace and using a ForEachLoop to cast to the walls, but this seems to have the same effect as the single line trace.

Thank you again for your consideration and time. If more details are needed I can provide.

Product Version: UE 4.19
world-2.jpg (253.2 kB)
raycast.jpg (488.3 kB)
more ▼

asked May 04 '18 at 05:09 PM in Blueprint Scripting

avatar image

8 2 4

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

2 answers: sort voted first

Use the MultiLineTraceByChannel node, which will return a vector of hits, instead of just one:

alt text

help.png (29.5 kB)
more ▼

answered May 04 '18 at 05:38 PM

avatar image

897 12 14 22

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

Use Multi line trace by channel like gancasmage said then for loop from the array, break the hit and trigger your "raycast hit" function

more ▼

answered May 05 '18 at 06:07 AM

avatar image

Kit Kat134
203 1 9 10

(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