Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FHitResult Hit;
- FVector CursorLocation;
- bool HitResult = false;
- HitResult = GetWorld()->GetFirstPlayerController()->GetHitResultUnderCursorByChannel(UEngineTypes::ConvertToTraceType(ECC_WorldStatic), true, Hit);
- if (HitResult)
- {
- FVector CursorFV = Hit.ImpactNormal;
- FRotator CursorR = CursorFV.Rotation();
- CursorToWorld->SetWorldLocation(Hit.Location);
- CursorToWorld->SetWorldRotation(CursorR);
- CursorLocation = Hit.Location;
- UE_LOG(LogTemp, Warning, TEXT("Cursor location %s!"), *CursorLocation.ToString());
- RockDestination = FVector(CursorLocation.X, CursorLocation.Y, 00.f);
- }
- FVector CurrentLocation = GetActorLocation();
- ThrowDistance = sqrt( pow( (CursorLocation.X - CurrentLocation.X), 2 ) + pow( (CursorLocation.Y - CurrentLocation.Y), 2 ) );
- UE_LOG(LogTemp, Error, TEXT("Throw distance %f"), ThrowDistance);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement