Changing CharacterController height


  • I’m working on a 3D endless runner.

  • I have my player object based on a CharacterController.

  • The player has the ability to roll (CharacterController will reduce it’s height by half for about 1.5 seconds)

           m_characterController.height *= .5f; -= Vector3.up * m_characterController.height * .5f;
  • Collision is still detected as if the CharacterController was in full height

  • CharacterController movement is NOTrestricted though, but the OnControllerColliderHit will trigger and the game will end

Anyone has an idea on why this could happen?

Apparently the collision detection is a bit off here. Even if I don’t modify the CharacterController directly, but the scale of the parent is not working. I’m still not sure what’s happening, but I managed to fix it by making the CharacterController collider even smaller than 50%.

    void SetRolling(bool state)
        if (state == m_rolling)

        m_rolling = state;
        m_animator.SetBool(m_animatorHash_Rolllling, m_rolling);

        if (state)
            m_aspectHolder.localScale *= 1 / m_rollingScale;
            transform.localScale *= m_rollingScale;
            transform.localScale *= 1 / m_rollingScale;
            m_aspectHolder.localScale *= m_rollingScale;

Where m_aspectHolder is the parent of my mesh + armature for my character and m_rollingScale is 0.1f now.