Created
June 24, 2016 07:24
-
-
Save embiem/ca9734a2c74236aeba5efe846d86a680 to your computer and use it in GitHub Desktop.
A function to get the look rotation by supplying it with a screen location (e.g. half the viewportSize, to use the middle of the screen). Useful for crosshairs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool GetLookDirection(FVector2D ScreenLocation, FVector& LookDirection) const | |
{ | |
FVector CameraWorldLocation; | |
return DeprojectScreenPositionToWorld( | |
ScreenLocation.X, | |
ScreenLocation.Y, | |
CameraWorldLocation, | |
LookDirection | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
UE doc: https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/APlayerController/DeprojectScreenPositionToWorld/index.html