Swimming Ability is getting stuck?

Hi I integrated the swimming add on to my character. Adding the abilities and animations using the add on manager. Everything works fine even adding custom water height detection so the character moves with the height of the waves.

However sometimes when getting out of the water it bugs out and the gets stuck on "Exit Water Moving" animation (the blue animation bar is full and just stays full) state and the character just stands there. You can still rotate the character but other than that the character is stuck. This can also happen on idle but instead it will keep looping without character moving.

1726609784141.png

I tested it out with the swimming avatar to make sure it isn't just my own character (which was built off atlas using its animations too anyways) still causes the same problem. I can see under the abilities the swim ability is active still when it shouldn’t be anymore. I can get the character unstuck again by switching off the swim ability in the inspector character will regain control again. Advice on avoiding that from happening?


1726609918932.png
 
Last edited:
Does the demo scene work correctly? Did you switch out the animations?
Yes demo scene works fine and no using the original animations. It looks like using custom water height detection confuses when the controller gets out of the water sometimes since the wave height keeps changing. I was able to recreate the issue in the demo scene. Setting the custom water height detection to custom and using it on a water shader that has ocean like waves so the character moves up and down with the waves.
 
Just to narrow it down, if you do not set the water surface position does everything work correctly? Does Swim.OnExitedWater get called?
 
Just to narrow it down, if you do not set the water surface position does everything work correctly? Does Swim.OnExitedWater get called?
So did few more tests in the demo scene yes everything works correctly if I do not set the water surface position and use the standard collider detection method. I tried to spam go in and out of the water could not get it stuck.

However in my map using standard collider setup without setting the water surface position getting stuck happens less frequently but still possible if you keep spamming getting in and out of the water. Water object has "water" layer and has a box collider trigger.

I went back to my custom water detection and added debug.log to SwimOnExitedWater to see if it is called when exiting the water and getting stuck. Yes each time it is called but for some reason doesn't stop the swim ability. All bit strange :D
 
Thanks, that narrows it down a bit.

So if OnExitedWater is getting called that's good. Could the swim ability be stopped by it is starting up again because the surface height changes so the character needs to start swimming again? One fix may be to add a transition from the exit water state back to the swimming state instead of the exit state. Take a look at the animator parameters - what is the ability index and ability int data? You could add a transition from the swim exit state to the swimming state based on those parameters.
 
Thanks, that narrows it down a bit.

So if OnExitedWater is getting called that's good. Could the swim ability be stopped by it is starting up again because the surface height changes so the character needs to start swimming again? One fix may be to add a transition from the exit water state back to the swimming state instead of the exit state. Take a look at the animator parameters - what is the ability index and ability int data? You could add a transition from the swim exit state to the swimming state based on those parameters.
Awesome think we found the issue! Spent the last 20minutes trying to get my character stuck and it hasn't happened again when it is usually very easy to get it stuck. Looks like it was the animation controller and the state not having a way go back to the swimming state. Made another transition to the swimming state removing the exit state and haven't managed to get it stuck again. I will do more tests to see if find any further issues. Thank you for your patience and the amazing support you give here.
 
Awesome think we found the issue! Spent the last 20minutes trying to get my character stuck and it hasn't happened again when it is usually very easy to get it stuck. Looks like it was the animation controller and the state not having a way go back to the swimming state. Made another transition to the swimming state removing the exit state and haven't managed to get it stuck again. I will do more tests to see if find any further issues. Thank you for your patience and the amazing support you give here.
Glad that worked! What transition did you add? I'll do the same to make updating easier for you.
 
Glad that worked! What transition did you add? I'll do the same to make updating easier for you.
Thanks I removed the exit transition for both Exit Water Moving and Exit Water Idle and instead made a transition back to Surface Swim and Surface Idle for both of them. I am not using underwater swimming or dive so didn't have to do anything to them.

In addition not sure if this did anything but just in case I also muted fall in water to exit transition and also made two transitions from Fall In Water to Surface Swim and Surface Idle.

1727129664392.png
 
Back
Top