本文整理汇总了C++中APawn::GetActorRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ APawn::GetActorRotation方法的具体用法?C++ APawn::GetActorRotation怎么用?C++ APawn::GetActorRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类APawn
的用法示例。
在下文中一共展示了APawn::GetActorRotation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddCinePawn
void ACinemotusPlayerController::AddCinePawn()
{
// pawnToAdd->
APawn* pawnToAdd = NULL;
int newIndex = 0;
while (newIndex < PawnsInScene.Num() &&!PawnsInScene[newIndex]->bHidden)
{
newIndex++;
}//keep going till we find a hidden one
if (newIndex >= PawnsInScene.Num())
{
//add a dude
UWorld* const World = GetWorld();
if (World)
{
// Set the spawn parameters
FActorSpawnParameters SpawnParams;
SpawnParams.Owner = this;
SpawnParams.Instigator = Instigator;
// Get a random location to spawn at
FVector SpawnLocation = GetPawn()->GetActorLocation();
// Get a random rotation for the spawned item
FRotator SpawnRotation = GetPawn()->GetActorRotation();
// spawn the pickup
pawnToAdd = GetWorld()->SpawnActor<ACinemotusDefaultPawn>(ACinemotusDefaultPawn::StaticClass(), SpawnLocation, SpawnRotation, SpawnParams);
}
}
else
{
pawnToAdd = PawnsInScene[newIndex];
APawn* pwn = GetPawn();
pawnToAdd->SetActorLocationAndRotation(pwn->GetActorLocation(), pwn->GetActorRotation()); //make this one added to where we are right now
}
pawnToAdd->SetActorTickEnabled(true);
pawnToAdd->SetActorEnableCollision(true);
pawnToAdd->SetActorHiddenInGame(false);
SwitchToPawn(pawnToAdd);
}
示例2: Teleport
void UCheatManager::Teleport()
{
FVector ViewLocation;
FRotator ViewRotation;
check(GetOuterAPlayerController() != NULL);
GetOuterAPlayerController()->GetPlayerViewPoint( ViewLocation, ViewRotation );
FHitResult Hit;
APawn* AssociatedPawn = GetOuterAPlayerController()->GetPawn();
static FName NAME_TeleportTrace = FName(TEXT("TeleportTrace"));
FCollisionQueryParams TraceParams(NAME_TeleportTrace, true, AssociatedPawn);
bool bHit = GetWorld()->LineTraceSingle(Hit, ViewLocation, ViewLocation + 1000000.f * ViewRotation.Vector(), ECC_Pawn, TraceParams);
if ( bHit )
{
Hit.Location += Hit.Normal * 4.0f;
}
if (AssociatedPawn != NULL)
{
AssociatedPawn->TeleportTo( Hit.Location, AssociatedPawn->GetActorRotation() );
}
else
{
ADebugCameraController* const DCC = Cast<ADebugCameraController>(GetOuter());
if ((DCC != NULL) && (DCC->OriginalControllerRef != NULL))
{
APawn* OriginalControllerPawn = DCC->OriginalControllerRef->GetPawn();
if (OriginalControllerPawn != NULL)
{
OriginalControllerPawn->TeleportTo(Hit.Location, OriginalControllerPawn->GetActorRotation());
}
}
}
}