Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. FHitResult Hit;
  2.     FVector CursorLocation;
  3.     bool HitResult = false;
  4.  
  5.     HitResult = GetWorld()->GetFirstPlayerController()->GetHitResultUnderCursorByChannel(UEngineTypes::ConvertToTraceType(ECC_WorldStatic), true, Hit);
  6.  
  7.     if (HitResult)
  8.     {
  9.         FVector CursorFV = Hit.ImpactNormal;
  10.         FRotator CursorR = CursorFV.Rotation();
  11.         CursorToWorld->SetWorldLocation(Hit.Location);
  12.         CursorToWorld->SetWorldRotation(CursorR);
  13.         CursorLocation = Hit.Location;
  14.         UE_LOG(LogTemp, Warning, TEXT("Cursor location %s!"), *CursorLocation.ToString());
  15.         RockDestination = FVector(CursorLocation.X, CursorLocation.Y, 00.f);
  16.     }
  17.  
  18.     FVector CurrentLocation = GetActorLocation();
  19.  
  20.     ThrowDistance = sqrt(   pow(    (CursorLocation.X - CurrentLocation.X), 2   ) + pow(    (CursorLocation.Y - CurrentLocation.Y), 2   )       );
  21.     UE_LOG(LogTemp, Error, TEXT("Throw distance %f"), ThrowDistance);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement