DrawDebug is way too large

I don’t know where I messed up, but when I draw the line the square is huge.

In the video the line coming from the player character is a small rectangle, and when viewed from the player it is a small square. When I look at mine it is large enough to cover the entire chair! When I eject the line is the same width as the player character.

Code and/or project? Or you can add this to the next lecture which goes over line tracing

const FName TraceTag("MyTraceTag");
GetWorld()->DebugDrawTraceTag = TraceTag;
FCollisionQueryParams TraceParameters(TraceTag, false, GetOwner());

instead of the just FCollisionQueryParams TraceParameters(FName(), false, GetOwner());

And you should be able to see the normals of any hits

void UGrabber::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

	// ...
	FVector PlayerViewPointLocation;
	FRotator PlayerViewPointRotation;

	GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(PlayerViewPointLocation, PlayerViewPointRotation);

	FVector LineTraceEnd = PlayerViewPointLocation + PlayerViewPointRotation.Vector() * Reach;
	//draw a red trace line
	DrawDebugLine
	(
		GetWorld(),
		PlayerViewPointLocation,
		LineTraceEnd,
		FColor(255.0f, 0.0f, 0.0f),
		false,
		0.0f,
		0.0f,
		10.0f
	);
}

It is during the building escape program, and above is the code.

I moved ahead in the lectures, and the LineTraceSingleByObjectType is working as expected. I am hoping that it is just a visual issue on my PC.

Thank you for the trace tag code. I entered it into my program and it makes visualizing the collisions easier.

Hello DanM I try this code and have a few question:

  1. what is white line which is against of red line?
  2. GetWorld()->DebugDrawTraceTag = TraceTag; by this order DebugDrawTraceTag = TraceTag, but how and where is DebugDrawTraceTag work it’s only variable not function?
  3. what is FName class and what it’s doing here FCollisionQueryParams TraceParameters(TraceTag, false, GetOwner()); ?
  1. I don’t know what you mean
  2. Not sure what your question is
  3. https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/StringHandling/FName/ And it’s a parameter for the FCollisionQueryParameters constructor and iti’s to set the TraceTag

  1. by using your code i get something like

image
white and red lines across each other
and what is white line and why they opposite each other?
what this photo means?

what is difference between this two orders:
FCollisionQueryParams TraceParameterss(FName(TEXT("")), false, GetOwner()); I have only red line

const FName TraceTag(“MyTraceTag”);
GetWorld()->DebugDrawTraceTag = TraceTag;
FCollisionQueryParams TraceParameters(TraceTag, false, GetOwner()); I have white and red lines opposite each other

  1. I cann’t understand how DegugDrawTraceTag is works?
    because without this order
    GetWorld()->DebugDrawTraceTag = TraceTag;
    we haven’t white line in the world

White lines mean you didn’t anything, red means you did, the arrow is the normal of the surface that you hit

And I still don’t quite understand what you are trying to say for your second question.

  1. sorry I want to define:
    white line do not mean anything and red line means that it is hitting. am I right?

  2. const FName TraceTag(“MyTraceTag”); // creat TraceTag object
    FCollisionQueryParams TraceParameters(TraceTag, false, GetOwner()); // pass the TraceTag as a parameter

    GetWorld()->DebugDrawTraceTag = TraceTag; // and what is this order doing?? what is it’s responsible?

    as i guess DebugDrawTraceTag is drawing or painting red line(TraceTag), is not it?

Sorry I forgot to reply to this.

bDrawDebugTrace When non-‘None’, all line traces where the TraceTag match this will be drawn.

So in our FCollisionQueryParams for our line trace we set the tracetag FName("MyTraceTag") which is the same as the worlds bDrawDebugTrace which means our linetrace will be drawn

thank you DanM and sorry I have so many questions :slight_smile:

Privacy & Terms