Hi, I’m trying to create a function that is going to rotate my character instantly to face the same direction that my camera is looking at. But my character seems to be looking in random directions when I use the function. Any idea what I’m doing wrong? Thanks!
void AcameramovementCharacter::Rotate()
{
FVector Location;
FRotator Rotation;
this->GetController()->GetPlayerViewPoint(Location, Rotation);
FRotator NewRotation = (FVector((this->GetActorRotation().Pitch), Rotation.Yaw, (this-
>GetActorRotation().Roll))).Rotation();
this->SetActorRotation(NewRotation);
}