Swimming Bugs - A quick bandade - Part 1

zroc

Member
Just wanted to point out to you in case you were not aware or they have not been reported.

Been doing a lot of stress testing with Swimming addon to see what I need to change for my needs, etc.. Upon my first test was to climb out of the water in the demo scene.

If you look away from where the player is climbing out of a mass number of log msgs get reported that the "Look rotation viewing vector is zero". Makes sense, but where in the heck is the msg coming from. Searched entire folders, etc. no msg avail to disable. Anyhow, because of this it also comes with an error which pretty much leaves the player potentially floating in the air or just idle and you can't return control back to the player unless you manually go into the inspector and disable "ClimbFromWater" ability which gets stuck in "Active" state. To avoid this a few things need to be added as a bandage, if you will, right now.

1) Open ClimbFromWater.cs ability script
2) In the AbilityStarted() Method, add a "Try/Catch" for fastest way to eliminate the breakage of execution when the error takes place;- starting roughly at line 87: The Entire Method should look like this:

Code:
protected override void AbilityStarted() {
            base.AbilityStarted();

            m_CharacterLocomotion.SingleCast(m_Transform.forward, Vector3.zero, m_CharacterLayerManager.SolidObjectLayers, ref m_RaycastResult);
            m_DetectedObjectNormal = Vector3.ProjectOnPlane(m_RaycastResult.normal, m_CharacterLocomotion.Up).normalized;

            // The character should be positioned relative to the top of the hit object.           
            try {
                if (m_RaycastResult.collider == null) { Debug.LogError("raycast.collider IS NULL"); }

                var closestPoint = m_RaycastResult.collider.ClosestPointOnBounds(m_Transform.position);
                var localClosestPoint = m_RaycastResult.transform.InverseTransformPoint(closestPoint);
                var localMaxBounds = m_RaycastResult.transform.InverseTransformPoint(m_RaycastResult.collider.bounds.max);
                localClosestPoint.y = localMaxBounds.y;
                m_TopClimbPosition = m_RaycastResult.transform.TransformPoint(localClosestPoint);
                m_InPosition = false;
                m_Moving = m_CharacterLocomotion.Moving;
            } catch (Exception e) {
                Debug.Log("[ClimbFromWater.AbilityStarted] :error: Exception Caught: " + e.Message + "\n" + e.StackTrace);
            }           
        }

3) In ShouldBlockAbilityStarted(......) Method, add an additional qualifier of " || startingability is ClimbFromWater ". Add this will eliminate the immediate breakage leaving the player stuck in an active ClimbFromWater ability with no input, etc.....
Method should look like this;
Code:
public override bool ShouldBlockAbilityStart(Ability startingAbility) {
            return startingAbility is HeightChange || startingAbility is ClimbFromWater;
}

Still looking to see where the major issues is on this to resolve properly. As I said this is just a bandade as I've come across various bugs or glitches.
 
Last edited:
Thanks, I'll take a look at these and let you know what I find out.

There is def a major glitch with this. Especially if you press jump while exiting the water. Sometimes it exits without fail while pressing jump but mostly it will glitch into a floating player with no weapons active, etc.. and the ability ClimbFromWater is left active.

One of the problems I believe is the detection while swimming and you can exit the water with a general walk and the animator goes into it's exitfromwater which in my opinion is kind of not needed. If a player is relative to the surface, underwater or above, the player should transition immediately to upright and start walking and ability should stop. I just don't understand why the player would go into a prone position to exit the water and then stand up. This whole transition just cause more delay in a player exiting the water as it has to start and wait for a new animation and causes delays. But hey that's just me... For a pool environment as in the demo it's not as prone to take place, but does, especially when pressing jump. But in real world game where your player is mostly swimming in a lake or deep pond or ocean, this is a major glitch that would just piss players off to no extreme.

I'm actively looking to see how this can be resolved, so will let you know if I find the glitches and work-around possibly for the resolve.
 
Just giving you a heads up that I tried to reproduce this but wasn't able to. When I look in the opposite direction while getting out the character exits from the water. The camera angle isn't the greatest but I tried about ten different times and didn't get any errors.


Are you doing anything differently?
 
Justin. Thanks for taking the time to do test that out. I'm afraid I have to report that in your testing you are purposely stopping and positioning your camera a specific direction. Perhaps I did not explain the true problem clearly.

Try doing it this way:
Jump into the water​
Swim to an edge but don't stop and press 'jump' when you are prompted to climb out​
While exiting and/or just as you start to exit, press jump move your camera​
I do believe I said this is a little harder to repro in the demo but I have been able to do it numerous times. I will make a vid and post it.
More importantly its 300% repo'd in a non demo scene because edges are not always gonna be square like in the demo. Also, even in the demo scene if you jump while getting out of the water, edge or terrain, your char will go into a holding state and float.
 
any news on this one?
we are experiencing a similar issue, whilst still moving forward with "W" key and simultaneously hitting "spacebar" (Jump key) our character is automatically moved during the animation to Zero, Zero on the map then completes the "climb from water" animation. occasionally our character will get stuck underground during this automatic movement.
if we do not hold "W" to move forward when hitting jump he climbs as intended at the edge of the water.
 
Are you able to reproduce it within a fresh project? I haven't been able to reproduce it.
 
Yes, this issue follows us throughout all new Testing fresh projects, within our game also.
I will take our swimming character into the Opsive Demo Project and test it there also.
 
Top