Hey, so i’m a bit confused at the moment. I’m working a bit on a project that have the player run around on a sphere. In the game the player actor rotates towards the center of the sphere it is walking on using this piece of code. The code is in the sphere class.
FVector PlayerActorLoc = Player->GetActorLocation();
FVector Direction = PlayerActorLoc - GetActorLocation();
FRotator PlayerRot = FRotationMatrix::MakeFromZ(Direction).Rotator();
Player->SetActorRotation(PlayerRot);
That works fine, but if i try to use the code below the result is very different and does not work at all. How is this possible? Do the values get altered when i put it into a new FRotator or something?
Player->SetActorRotation(FRotator(PlayerRot.Roll, PlayerRot.Pitch, PlayerRot.Yaw));