Skip to content

Instantly share code, notes, and snippets.

View theshaneobrien's full-sized avatar
🎮
Jamming

Shane theshaneobrien

🎮
Jamming
View GitHub Profile
@theshaneobrien
theshaneobrien / MousePosRaycast.cpp
Last active July 15, 2022 09:34
Unreal Engine Mouse Position in Screen Space to World Location then Sweep / LineCast / RayCast
void USelectionController::TryGetUnitAtMousePos()
{
// This is the variable that will be populated by whatever we hit with our sweep
FHitResult HitResult;
if(SweepToMousePos(HitResult))
{
HitResult.GetActor()->Tags.Add("Selected");
//Draw a sphere where we hit
DrawDebugSphere(GetWorld(), HitResult.ImpactPoint, 100, 10,FColor::Green, false, 5);