I have a character with enhanced input and animations. It’s a 3D character constrained to move in a 2D plane. The character has an attached camera with a world rotation which views the scene from the side.
The user can only control if the character moves left or right using the A and D keys:
AddMovementInput(Direction, Value);
How can I turn the character to face the travelling direction?
I want the 180 degree turn to play out over a set duration. Even if the user just taps the direction key briefly, the character should still smoothly rotate to the target direction. Ideally this would also trigger a custom turning animation. The camera should never rotate.
I have tried a lot of things but nothing works as intended.
Make sure that the animation is in place and the animation doesn’t actually turn, since we’re already rotating the mesh. It should just be some in place leg movements with a head turn or whatever you like.
Also, this can as well be done by purely visuals so that we don’t need to rotate the mesh ourselves using a timeline. Something to consider. You can just negate a vector type variable that stores a unit vector inside every time the character “turns”, if you wanna use the forward vector.