My version of "GetPlayersReach()"

void UGrabber::GetViewTrace(FVector &LineTraceEnd,
							FVector PlayerViewPointLocation = FVector(),
							FRotator PlayerViewPointRotation = FRotator()) const
{
	GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
		OUT PlayerViewPointLocation,
		OUT PlayerViewPointRotation
	);

	LineTraceEnd = PlayerViewPointLocation + PlayerViewPointRotation.Vector() * Reach;
}

Not sure. Is it good version.

1 Like

Does it work properly?

Yeah! It’s working how I want it to work. I call this function with arguments which I wanna know like this “GetViewTrace(OUT LineTraceEnd, OUT PlayerViewLocation)”. “FVector PlayerViewPointLocation = FVector()” - this part implement arguments with default vector or rotator. So if I have only one function argument, it still work but it’s define only arguments with I call.

Privacy & Terms