Skip to content

Instantly share code, notes, and snippets.

@DarkDesire
Last active August 28, 2016 01:40
Show Gist options
  • Save DarkDesire/ec44aad3c7301476169bb3f40f7b9b75 to your computer and use it in GitHub Desktop.
Save DarkDesire/ec44aad3c7301476169bb3f40f7b9b75 to your computer and use it in GitHub Desktop.
#define OUT
// Used for saving ViewPortLocation
FVector PlayerViewPointLocation;
// Used for saving ViewPortRotation
FRotator PlayerViewPointRotation;
void GetPlayerViewPort(){
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
OUT PlayerViewPointLocation,
OUT PlayerViewPointRotation );
}
FVector GetReachLineEnd(){
GetPlayerViewPort();
return PlayerViewPointLocation + (PlayerViewPointRotation.Vector() * Reach);
}
/// Drawing a red debug line
DrawDebugLine( GetWorld(), PlayerViewPointLocation, GetReachLineEnd(), FColor( 255, 0, 0 ), false, 0.f, 0, 2.f );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment