Hello everyone!
I am having trouble trying to get my character facing forwards smoothly.
As you may see in the video, when I am facing backwards, and try to walk forwards, the character rotates smoothly, but when I shoot, the character just immediately facing forwards. I want it to be smooth like in the walking rotation.
For the function of the shooting I set “Use controller rotation yaw” to true, and when I release the button it is set back to false. This is how I ensure the character will always face forwards, but I was wondering if there is any other way to do that because it is not giving the result I wanted.
Hey there, you can’t really do that because you’ll get that pop. When you shoot you need to get the control rotation and extract the yaw and interpolate it along time.
I’ve got this working on my character. It will smoothly rotate the character for you.
Your problem is that you’re setting UseControllerRotationYaw immediately. What you want to do is set UseControllerDesiredRotation and set a bool (i.e. “TurningInPlace”) to true. And in your tick function, you want to do this
In my game, at the point where I turn UseControllerRotationYaw on, he is in an aiming state (rifle raised). With client/server, rotation isn’t smoothed on the clients so you would have to do that yourself if you need it. Also, you can control the rotation rate.with SetRotationRate.
Oh wait. That’s not quite my code. Mine is more complex because I consider that the player may start moving before the turn is complete. I tried to simplify it to make it easier on you. So I included the UseControllerRotationYaw by mistake. You can probably just drop that node – though it should still have worked, he just would have been locked to the camera at the end.