The location of the DefaultPawn is equal to the Player view point

The location of the DefaultPawn is equal to the location of the Player view point.
This is tested by the following codes.

void UGrabber::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

FVector PlayerViewPointLocation;
FRotator PlayerViewPointRotation;

AActor* ThisOwner = GetOwner();
FVector ThisOwnerLocation = ThisOwner->GetActorLocation();

GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(PlayerViewPointLocation, PlayerViewPointRotation);

UE_LOG(LogTemp, Warning, TEXT(“The %s (At %s) is looking at %s and turnning at %s”),
*ThisOwner->GetName(),
*ThisOwnerLocation.ToString(),
*PlayerViewPointLocation.ToString(),
*PlayerViewPointRotation.ToString());

float Temp = 0;
}

For this specific pawn, yes. But that’s not true for all pawns.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms