Forum rules - please read before posting.

First Person AC Bouncing/Stepping when going down slopes

Hi,

When using the First Person AC player, how can I smooth out the Bouncing/Stepping effect when walking down a slope? (not anything related to the head bob)

I feel like I need somehow to set/check if the player is grounded more often, as walking down a ramp produced the visual effect of dropping down steps.

I can put the players Simulated Mass up - this produces a smoother walk down slope effect, but if the player is running I then see jagged micro steps again.

What am I missing?

If I watch the PlayerAnimation Controller, I see when heading down a slope it flicks from Motion to Idle over and over, I presume that is when the controller thinks player is freefloating each step for a second before gravity is grounding the player. Is that the cause of the Bounce or just a side effect?

Comments

  • edited April 28
    Following. Same problem here
  • Is that the cause of the Bounce or just a side effect?

    I'll attempt a recreation, but the most reliable way to check this is to remove the Animator controller asset from the Animator. Does the bouncing persist?

  • Try attaching this:

    using UnityEngine;
    using AC;
    
    public class SlopeForce : MonoBehaviour
    {
    
        [SerializeField] private AC.Char character = null;
        [SerializeField] private CharacterController characterController = null;
        [SerializeField] private float slopeForce = 5f;
        [SerializeField] private float rayLengthFactor = 1.5f;
    
        private void Update ()
        {
            if (character.charState == CharState.Move || character.charState == CharState.Decelerate)
            {
                if (IsOnSlope () && !character.IsJumping)
                {
                    characterController.Move (Vector3.down * characterController.height / 2f * slopeForce * Time.deltaTime);
                }
            }
        }
    
        private bool IsOnSlope ()
        {
            RaycastHit hit;
            if (Physics.Raycast (transform.TransformPoint (characterController.center), Vector3.down, out hit, characterController.height / 2f * rayLengthFactor))
            {
                return hit.normal != Vector3.up;
            }
            return false;
        }
    
    }
    
  • edited May 1

    I'll attempt a recreation, but the most reliable way to check this is to remove the Animator controller asset from the Animator. Does the bouncing persist?

    Removing the Animator controller made no difference. The bounce or visual stepping still occured then.

    However the Fantastic new code SlopeForce looks like it has fixed the issue! Thank you. I found it worked when attached to the Camera of the First Person player, not the player object itself, for those trying it.

    Thank you.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.