I have completed the Unity 3rd Person Combat & Traversal course which was very instructional on creating a player controller via a state machine. Loved the format and detailed explanations to help us understand.
I’ve been tweaking the controller to customize it to how I wanted my game to work which is similar to Elden Ring. I have been attempting to modify the PlayerDodgingState to use a rolling animation instead of the dash.
I am able to run the rolling animation but the player is only rolling in place and not being moved. Given the Tick logic of the state I feel it has everything I need to move the player in the direction of the dodge using the new Rolling animation:
public override void Tick(float deltaTime)
{
Vector3 movement = new Vector3();
movement += _stateMachine.transform.right * _dodgingDirectionInput.x * _stateMachine.DodgeLength / _stateMachine.DodgeDuration;
movement += _stateMachine.transform.forward * _dodgingDirectionInput.y * _stateMachine.DodgeLength / _stateMachine.DodgeDuration;
Move(movement, deltaTime);
//FaceTarget();
_remainingDodgeTime -= deltaTime;
if (_remainingDodgeTime <= 0f)
{
ReturnToLocomtion();
}
}
I have tried changing the DodgeLength and DodgeDurations but the new Rolling animation closely matches the same specs as the Dash animation used in the course. However, when the character rolls he only does so in place and not moving on the screen.
The only true changes I made to support this was to disable the character controller in the Start method and re-enabled in the Exit method as well as commenting out the FaceTarget as I wanted the player facing the direction they are rolling and then when the state switches the player’s direction can be updated given their new state.
Any ideas how to force the player to move in the Dodge direction while the animation is running?
Thanks,
Craig