I want to print to screen the camera component’s rotation values like so:
const FRotator CameraRotation = FollowCamera->GetComponentRotation();
if (GEngine)
{
//Print debug message
GEngine->AddOnScreenDebugMessage(-10, 1.f, FColor::Yellow, CameraRotation);
}
But it says "cannot convert argument 4 from ‘const FRotator’ to ‘const FString &’
What should I use to print out the rotation values of the camera please?
Thanks
I’m basically trying to do the equivalent of this in UDK but in C++:
GetAxes(CurrentCameraRotation, X, Y, Z);
NewAccel.Z = 0;
NewAccel = PlayerInput.aForward*X + PlayerInput.aStrafe*Y;
NewAccel = Pawn.AccelRate * Normal(NewAccel);
You just have to convert it to FString. I don’t have the engine with me to test so my apologies if this isn’t true, but I believe FRotators and FVectors have a .ToString() method.
Jambax
(Jambax)
April 6, 2015, 8:54pm
4
Using the TEXT Macro is probably the easiest way:
const FRotator CameraRotation = FollowCamera->GetComponentRotation();
if (GEngine)
{
//Print debug message
GEngine->AddOnScreenDebugMessage(-10, 1.f, FColor::Yellow, FString::printf(TEXT("Rotation: %f - %f - %f"), CameraRotation.Pitch, CameraRotation.Yaw, CameraRotation.Roll));
}
2 Likes
hmm, thanks TheJamsh but there seems to be a problem with:
I get a red wiggly line under it anyway. “Fstring has no member printf”
Also, whats the equivalent of Uncodex for C++ for Unreal?
Thanks
Jambax
(Jambax)
April 7, 2015, 10:54pm
6
Try Printf. I might not have got the capitalization right.
Intellisense / VAX should fix that for you though.