Drawdebugline for a ...vector?

Hey all,
I was playing with drawdebugline in the hopes of getting the current movement vector of my character visible. However I’m a little confused as to the LineStart and LineEnd parameters… I was using rootcomponent as the line start but I have no idea how to get a point from the tip of a vector to use as line end? I tried inputting the vector itself as line end but the result is definitely not correct. I googled the **** out of this with no luck so hopefully someone here knows how to do this.

Thanks!

Bump: anyone know this?

Hi,

to get the endpoint you just have to add the vector to the startpoint (endpoint = startpoint + vector).

Regards

Ah, I was looking for something way more complicated hah, thanks!

I’m not sure what you want to do with that draw line, but for example, if you wanted to draw a line to where the character is looking at, you’d do:


APlayerController *Controller = GetWorld()->GetFirstPlayerController();
FVector Start = GetActorLocation();
float DistanceToTrace = 100.0f;
FVector End = GetActorLocation() + (Controller->GetActorForwardVector() * DistanceToTrace);

Using those Start and End you’d get a line of 100 units long coming out of your character.

I’m using it to show a motorvector from the rootcomponent so it’s easier to visualize what it’s doing :slight_smile:

Thanks!