I cant rotate my character with c++

Like the tittle says im not able to rotate my character with c++. I have a wall run mechanic in my game but when the character exits the wall run its rotation changes to the one it had before. I think this happens beacause i set Camera->bUsePawnControlRotation = false; and bUseControllerRotationYaw = false; before the wall run and after the wall run is done i set them back to true. But when those are set to true the only way i can rotate my character is with AddControllerYawInput but using this the rotation change takes to long and i want it to be done in an instant.

If you know why the rotation goes back or if you know how to rotate the character please help me. Thanks in advance.

Hi @Fire_Ale! How are you? Could you share a video of the issue? How are you rotating the player when it overlaps with the wall?

The function you should use to rotate the player’s Actor is SetActorRotation, where you pass an FRotator (which you could recreate using the normal of the wall’s surface).


Heres a video of the issue. I rotate the palyer using the onHit function and using setActorRotattion. I think i already tried setActorRotation for after the wall run but im gonna try again. The problem i think i have is that when bUseControllerRotationYaw = true; setActorRotation is not working.

Oh! I see now! It’s an First Person camera!

Have you tried using the combination of Controller->SetControlRotation(..) + bUseControllerDesiredRotation = true (in the CharacterMovementComponent)?

I didnt try that yet. In Controller->SetControlRotation(..) would you put an FRotator value?

Yes! You should set the desired rotation (FRotator) that you want the camera to have, just like in this thread: How do I use "Set Control Rotation" so that the player is instantly rotated the next frame (not slowly)? - #8 by Gnodima.

Thank you so much for your help it works with this!