Example #1
0
    void UpdateCrouchState(Vector2 input, Vector3 velocity)
    {
        previousCrouchState = crouching;
        crouching           = (ropeAttached) ? false : (input.y < -0.5 && controller.collisions.below);

        // If player is uncrouching, check that there is room to.
        if (previousCrouchState && !crouching)
        {
            crouching = controller.CheckUncrouch(velocity * Time.deltaTime);
        }

        controller.SetCrouchCollisions(crouching);

        // // If crouch state changed, update raycast spacing
        if (previousCrouchState != crouching)
        {
            controller.CalculateRaySpacing();
        }
    }