Ledge Strafe collision detection issue and fix

Cheo

Active member
Hello, the Ledge Strafe ability does not correctly use input for collision detection when playing in first person or with tank controls. Here's a video I made on the subject :


And here is the simple code I made to fix this (not exemplary I'm sure but you get the idea) :

C#:
            float inputTest = m_CharacterLocomotion.RawInputVector.x;

            if (m_CharacterLocomotion.FirstPersonPerspective)
            {
                inputTest *= -1;
            }

            // Stop movement if an object is in the way.
            RaycastHit hit = new RaycastHit();
            if (m_CharacterLocomotion.RawInputVector.sqrMagnitude > 0 &&
                m_CharacterLocomotion.SingleCast(m_Rigidbody.rotation * Vector3.right * (inputTest < 0 ? 1 : -1), Vector3.zero,
                            m_WallOffset + (!m_CharacterLocomotion.Moving ? 0.1f : 0), m_CharacterLayerManager.SolidObjectLayers, ref hit))
            {
                m_CharacterLocomotion.InputVector = m_CharacterLocomotion.RawInputVector = Vector2.zero;
                return;
            }

Hope this can be fixed in the next update.
 
Top