Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sephirot47/466e29c7cded26d72ae2 to your computer and use it in GitHub Desktop.
Save sephirot47/466e29c7cded26d72ae2 to your computer and use it in GitHub Desktop.
UE4 Get Camera Location or Position and Forward Vector (useful for Tracing)
APlayerCameraManager *camManager = GetWorld()->GetFirstPlayerController()->PlayerCameraManager;
FVector camLocation = camManager->GetCameraLocation();
FVector camForward = camManager->GetCameraRotation().Vector();
@Wllew4
Copy link

Wllew4 commented May 29, 2020

YOOO I know this comment is coming in 5 years after the post but this works, tysm!!! Extremely helpful.

@danrol
Copy link

danrol commented Nov 16, 2021

It helped me in 2021 :) Thanks

@SupreetoSaha
Copy link

Thanks a lot :)

@pold500
Copy link

pold500 commented Jun 22, 2022

Thanks man!

@jukrb0x
Copy link

jukrb0x commented Jun 28, 2022

CameraManager = UGameplayStatics::GetPlayerCameraManager(GetWorld(), 0);

@RandomExplosion
Copy link

Also Works in ue5

@MasterAirscrachDev
Copy link

still works in UE5, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment