void APawnWithCamera::DoTrace() { FVector Loc = CameraOne->GetActorLocation(); UE_LOG(LogClass, Error, TEXT("Loc is %s"), *Loc.ToString()); FRotator Rot = CameraOne->GetActorRotation(); UE_LOG(LogClass, Error, TEXT("Rot is %s"), *Rot.ToString()); FVector Start = Loc; UE_LOG(LogClass, Error, TEXT("Start is %s"), *Start.ToString()); FVector End = Loc + (Rot.Vector() * Distance); UE_LOG(LogClass, Error, TEXT("End is %s"), *End.ToString()); TempActor->SetActorLocation(End); FCollisionQueryParams TraceParam = FCollisionQueryParams(FName(TEXT("Trace")), true, this); TraceParam.bTraceComplex = true; TraceParam.bTraceAsyncScene = true; TraceParam.bReturnPhysicalMaterial = false; TraceParam.AddIgnoredActor(this); FHitResult Hit(ForceInit); GetWorld()->LineTraceSingle(Hit, Start, End, ECC_Pawn, TraceParam); DrawDebugLine(GetWorld(), Start, End, FColor(255, 0, 0), false, -1, 0, 12.33f); if (Hit.bBlockingHit) { UE_LOG(LogClass, Error, TEXT("Hit Something")); } else { UE_LOG(LogClass, Error, TEXT("No Hit")); } }
FString UKismetStringLibrary::BuildString_Rotator(const FString& AppendTo, const FString& Prefix, FRotator InRot, const FString& Suffix) { // faster, preallocating method FString const RotStr = InRot.ToString(); FString StringResult; StringResult.Empty(AppendTo.Len()+Prefix.Len()+RotStr.Len()+Suffix.Len()+1); // adding one for the string terminator StringResult += AppendTo; StringResult += Prefix; StringResult += RotStr; StringResult += Suffix; return StringResult; }
void UCheatManager::BugItWorker( FVector TheLocation, FRotator TheRotation ) { UE_LOG(LogCheatManager, Log, TEXT("BugItGo to: %s %s"), *TheLocation.ToString(), *TheRotation.ToString() ); Ghost(); APlayerController* const MyPlayerController = GetOuterAPlayerController(); if (MyPlayerController->GetPawn()) { MyPlayerController->GetPawn()->TeleportTo( TheLocation, TheRotation ); MyPlayerController->GetPawn()->FaceRotation( TheRotation, 0.0f ); } MyPlayerController->SetControlRotation(TheRotation); }
FString UKismetStringLibrary::Conv_RotatorToString(FRotator InRot) { return InRot.ToString(); }
void UCheatManager::BugItStringCreator( FVector ViewLocation, FRotator ViewRotation, FString& GoString, FString& LocString ) { GoString = FString::Printf(TEXT("BugItGo %f %f %f %f %f %f"), ViewLocation.X, ViewLocation.Y, ViewLocation.Z, ViewRotation.Pitch, ViewRotation.Yaw, ViewRotation.Roll); UE_LOG(LogCheatManager, Log, TEXT("%s"), *GoString); LocString = FString::Printf(TEXT("?BugLoc=%s?BugRot=%s"), *ViewLocation.ToString(), *ViewRotation.ToString()); UE_LOG(LogCheatManager, Log, TEXT("%s"), *LocString); }
void APawn::FaceRotation(FRotator NewControlRotation, float DeltaTime) { // Only if we actually are going to use any component of rotation. if (bUseControllerRotationPitch || bUseControllerRotationYaw || bUseControllerRotationRoll) { const FRotator CurrentRotation = GetActorRotation(); if (!bUseControllerRotationPitch) { NewControlRotation.Pitch = CurrentRotation.Pitch; } if (!bUseControllerRotationYaw) { NewControlRotation.Yaw = CurrentRotation.Yaw; } if (!bUseControllerRotationRoll) { NewControlRotation.Roll = CurrentRotation.Roll; } #if ENABLE_NAN_DIAGNOSTIC if (NewControlRotation.ContainsNaN()) { logOrEnsureNanError(TEXT("APawn::FaceRotation about to apply NaN-containing rotation to actor! New:(%s), Current:(%s)"), *NewControlRotation.ToString(), *CurrentRotation.ToString()); } #endif SetActorRotation(NewControlRotation); } }
inline FString convert(FRotator x) { return x.ToString(); }