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"

Toggle Linetrace

I currently have a line trace setup with a particle system attached to it. I have a BP for a switch that will turn the particle on and off. However, the line trace only turns on and remains in that state. How can I get the line trace to also turn on and off with the particle.

The screenshot below just shows a quick view of how I attempted to toggle the line trace. The boolean "is active" is a boolean that is attached to my laser BP, which has multiple functions for handling the particle and line tracing. It is referenced in my Switch BP and properly toggles on and off when the player is in the switches trigger box and presses "E". So I thought attaching that same boolean to a branch before my line trace would work, but it didn't. Any help would be appreciated. alt text

Product Version: UE 4.19
Tags:
more ▼

asked Oct 21 '18 at 07:05 PM in Blueprint Scripting

avatar image

MagiaNegra89
21 1 2 6

avatar image Steve SybrSyn Oct 21 '18 at 08:25 PM

If you’re switching that bool state in another blueprint and you just created a bool with thesame name in this blueprint then that is not going to work, they would be considered two different bools. You will need to get a reference to your linetrace blueprint from yourswitchand access that is active bool to change its state.

avatar image MagiaNegra89 Oct 21 '18 at 08:31 PM

Oh no, that's the same bool. Sorry for not making that clear, I will edit that in the original post. That screenshot is from a function in the lasers BP, which handles the line tracing. There is a different function that sets it to active and emits the particle.

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

3 answers: sort voted first

Your debug type is set to Persistent. I think that makes the debug line show forever. Is that the problem youre having?

more ▼

answered Oct 22 '18 at 01:10 AM

avatar image

mightyenigma
3.8k 18 24 21

avatar image MagiaNegra89 Oct 22 '18 at 01:26 AM

No, I just did that so I could see if the line was being drawn and would toggle off, I forgot to change it back. I need that line trace to turn on and off. I took some screenshots to try and explain it a little.

So when I hit play, there is no line trace or beam. That small cube is my (temporary) switch, so when the player is in the trigger box and press E. The beam will emit, along with the line trace. Once it hits the cube that has no color, it will light up the cube and also light up the small sphere next to it. alt text

This is how it looks once the beam and line trace are on. The beam stops emitting like it should once it hits an object and the line trace continues like it should as well. The other cube is now turned on and so is the sphere (I just took the screenshot too early and didn't capture it while on, because it flashes) alt text

This screenshot is where the problem is, as you see the beam is gone because the player pressed "E" again to turn it off. However, the line trace did not turn off, which means the other cube and sphere are still turned on (once again took the screenshot too early, so now the cube is off lol). I need the line trace to also turn off along with the beam. alt text

avatar image Kit Kat134 Oct 22 '18 at 01:56 AM

Could you post screenshots of more of your blueprint setup? It's a bit hard to understand what might be going wrong with only that first screnshot

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

I set the target to the same point where the start is when it's inactive. So the trace length becomes zero.

more ▼

answered Oct 22 '18 at 08:39 AM

avatar image

Tuerer
1.8k 12 7 9

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

Just to clarify, are you sure the line trace is still firing? Because with debug set to persistant it will show that red debug line forever, even if the trace is not running. And if you are setting that bool to false there would be no way that line trace is firing. It looks like you are just seeing the result of the debug line. Have you tested to see if the bool is ever going false by printing its value? And have you tested if the trace is actually running by printing the actor it is hitting? Because it may not be the line trace not turning off that's the issue.

To test you could also switch the trace debug from persistent to duration.

more ▼

answered Oct 22 '18 at 04:04 AM

avatar image

Steve SybrSyn
1.5k 4 5 10

avatar image MagiaNegra89 Oct 22 '18 at 04:34 AM

I actually didn't think to try printing the hit actor. Turns out it was not hitting anything. The reason the cube and sphere were staying on was because of a BP interface I had setup and forgot to call. I finally got the issue resolved. Thank you all!

Can't figure out how to mark this as answered lol

avatar image Steve SybrSyn Oct 22 '18 at 02:08 PM

No problem, to the left of the comment is up and down arrows and undernether that is a check box to mark an answer as correct.

(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