Sixze / ALS-Refactored

Completely reworked and improved C++ version of Advanced Locomotion System V4.
MIT License
978 stars 273 forks source link

Cannot set default gait to walking. #438

Closed mmodi3 closed 6 months ago

mmodi3 commented 9 months ago

Desired gait in settings only applies on spawn, after sprinting it always defaults back to the run state.

jomath229 commented 9 months ago

This is caused by the logic in AAlsCharacterExample::Input_OnSprint(const FInputActionValue& ActionValue)

SetDesiredGait(ActionValue.Get<bool>() ? AlsGaitTags::Sprinting : AlsGaitTags::Running);

Modify the function to use the desired gait instead of the hardcoded AlsGaitTags::Running.

SetDesiredGait(ActionValue.Get<bool>() ? AlsGaitTags::Sprinting : DesiredGait);

This is not an issue, its simply not implemented they way you might think it works. DesiredGait is suppose to represent the Gait you want at a moment in time. If you set it to walking in the settings, and after sprinting it goes back to running, it's simply because the code logically sets the DesiredGait to running when sprinting is over.

See comments regarding this in AAlsCharacter::CalculateMaxAllowedGait() and AAlsCharacter::CalculateActualGait(const FGameplayTag& MaxAllowedGait)

From how the logic is implemented, different criteria of view rotation modes and other stuff can affect which gait you can use at a given time, so even if you set the desired gait to something, it might not be allowed to be used. Just adapt the logic in the 3 functions mentioned above to get the behaviour you want.