I have a function that worked in BP which I attached in a image below. Please help me to caculate the Final Rotation of actor after AddActorLocalRotaion 2 times.
Thank for reading.
P/s: I’m not good at english
Most of blueprint nodes are C++ bindings, Target in tells you which class function is from, but in this case you clearly calling functions on actor you are in. You can convert you nodes like this:
FRotator Rot = GetActorRotation();
AddActorLocalRotation(FRotator(0.0f,0.0f,360.0f - Rot.Roll));
AddActorLocalRotation(FRotator(360.0f - Rot.Pitch,0.0f,0.0f));
As for binding keys you need input component for that, to look up how to set it up create C++ template project ofr 3rd perspective template for example
@Shadownriver Thanks for your help but it’s not my expect.
It should be:
FRotator Rot = GetActorRotation();
AddActorLocalRotation(FRotator(0.0f, 0.0f, 360.0f - Rot.Roll));
FRotator RotAfterAdd = GetActorRotation();
AddActorLocalRotation(FRotator(360.0f - RotAfterAdd.Pitch, 0.0f, 0.0f));
FRotator FinalRotation = GetActorRotation();
I just want to know how to caculate the FinalRotation without AddActorLocalRotation 2 times
I got the answer. Its very simple. The Final Rotation is FRotator(0.f,GetActorRotation().Yaw,0.f);