I have a variable FTransform NewPosition. I want to print its location and rotation on screen. I saw this link: Beginner how to Print Variable to Screen Question but it doesn’t tell me how to do it specifically for transforms. Here is an attempt:
SetActorTransform(NewPosition);
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red,
FString::Printf(TEXT("Position: x= %f , y= %f , z= %f , Orientation: tilt= %f , pan= %f , yaw= %f"), NewPosition));
Thanks!
1 Like
I’m sorry, I may need it to be more specific. Here is the attempt again:
SetActorTransform(NewPosition);
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red,
FString::Printf(TEXT(FTransform::ToString(NewPosition))));
The I get is on TEXT which says: name followed by “::” must be a class or namespace name
1 Like
Try:
NewPostion->ToString()
rather than
FTransform::ToString(NewPosition)
1 Like
I get the following error:
You don’t need to wrap it in the “TEXT() or Printf” - try with just “NewPostion->ToString()” rather than “FString::Printf(TEXT(NewPostion->ToString()))”.
The “FString::Printf()” is for when you need to pass in parameters individually - but the “ToString()” creates a full string with all the values already passed in…
1 Like
Thank you. I think I’m getting close enough to the solution. I only have this error now:
Ah yes - close instead of the “->” (which is for “pointers”), use “.” (for references)
1 Like