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"

Draw debug lines for line tracing

Hi guys,

I am using the GetWorld()->LineTraceSingle() function in CPP code to trace some things. It would be very handy for me to actually see some debug lines drawn by an engine, while a tracing happens. In Blueprints, it is easily done with DrawDebugTrace checkbox, which is present in all the tracing nodes. Is it possible to enable it in C++?

Product Version: Not Selected
Tags:
more ▼

asked Apr 11 '14 at 01:07 PM in C++ Programming

avatar image

Lordink
244 47 54 61

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

3 answers: sort voted first

Hey, you should be able to do this with the following code:

 const FName TraceTag("MyTraceTag");
 
 World->DebugDrawTraceTag = TraceTag
 
 FCollisionQueryParams CollisionParams;
 CollisionParams.TraceTag = TraceTag;
 ...
 // Use CollisionParamsto perform your line trace
more ▼

answered Apr 11 '14 at 01:22 PM

avatar image

BrɑκеPɑd STAFF
1.5k 33 22 78

avatar image Lordink Apr 11 '14 at 02:55 PM

Thanks, it works just fine.

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

https://wiki.unrealengine.com/Draw_3D_Debug_Points,_Lines,_and_Spheres:_Visualize_Your_Algorithm_in_Action!

 DrawDebugLine(
             GetWorld(),
             traceStart,
             hit.Location,
             FColor(255, 0, 0),
             false, -1, 0,
             12.333
         );
more ▼

answered Apr 11 '14 at 01:30 PM

avatar image

simmania
190 28 37 120

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

There's apparently now a console command, as well. > TraceTag <name>

Note that async traces will not call the debug draws, however.

more ▼

answered Jan 25 '17 at 12:32 AM

avatar image

VictorRachels
226 7 5 9

(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