How do I block abilities while the player is rotating?

I'm making a game using the 2.5D movement and camera type and I want to prevent the player from attacking while they're in the process of turning around (so that they don't attack off to the side where there will never be enemies). Is there a way to block the player from attacking while they're turning around?
 
You can use the state system to disable abilities (i.e. add a state preset to each ability that you want to disable which sets "Enabled" to false, and assign that state preset to the relevant state name). The issue here is how to activate that state, since the basic rotational movement is not an ability or anything that could easily activate a state.

The easiest solution I can think of is to have a simple script that runs on the character and checks the character's current rotation, and manually activates/deactivates that state (using StateManager.SetState) based on the rotation value. E.g. you could check the character object's transform euler angles Y value, and if it's a multiple of 90 (or within +/- 5 degrees or so, e.g. 85-95) then activate the state.

More info on the state system: https://opsive.com/support/documentation/ultimate-character-controller/state-system/
 
You can use the state system to disable abilities (i.e. add a state preset to each ability that you want to disable which sets "Enabled" to false, and assign that state preset to the relevant state name). The issue here is how to activate that state, since the basic rotational movement is not an ability or anything that could easily activate a state.

The easiest solution I can think of is to have a simple script that runs on the character and checks the character's current rotation, and manually activates/deactivates that state (using StateManager.SetState) based on the rotation value. E.g. you could check the character object's transform euler angles Y value, and if it's a multiple of 90 (or within +/- 5 degrees or so, e.g. 85-95) then activate the state.

More info on the state system: https://opsive.com/support/documentation/ultimate-character-controller/state-system/
That seems like a good solution, the only problem I can think of is that I don't think it'll work with 2.5D paths.
 
Would there be a way to use the yaw animator controller parameter? It seems like yaw always changes when and only when the player is turning around, but it takes almost a second to go back to zero after turning so blocking attacks when it's above zero would make the player unable to attack for too long after turning.

Is there a way to make the yaw value snap down to zero quicker? I read about the UCCs spring system and the "springs" "stiffness". Does the turning system - specifically the yaw animator parameter - use the spring system and if so would adjusting the stiffness cause yaw to snap to zero quicker instead of lingering at really small numbers for almost a second after turning?
 
Character rotation doesn't use the spring system -- the yaw value is dampened by the "Yaw Damping Time" property on the AnimatorMonitor component, so if you set it to 0 it will get set to its target value immediately.
 
Top