Alternative To finding end for line trace

You can calculate end point for line trace by adding ForwardVector * Distance.

GetOwner()->GetActorLocation() +GetOwner()->GetActorForwardVector()*TmpDistance;

However for this to work our pawn needs to rotate (default is rotation of camera only).
To turn it on you need to set “Use Controller Rotation Pitch” Yaw and Roll in pawn blueprint in its details panel (just search for “Controller Rotation”, it will pop up). This method allows grabber (or line trace) to work from actors that do not have viewport.

Privacy & Terms