Skip to content

Instantly share code, notes, and snippets.

@embiem
Created June 24, 2016 07:24
Show Gist options
  • Save embiem/ca9734a2c74236aeba5efe846d86a680 to your computer and use it in GitHub Desktop.
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
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