A* Pathfinding Project

Gravity problem with unity 2017.3 (using RootMotion + RichAi)


#1

Hello,

I just upgraded from 5.6.3 to the latest 2017 version and I noticed that the Ai is not grounded while it’s moving, it just moves in the air and this wasn’t a problem in 5.6.3, my root motion code is the same and I have the Y gravity set to -559

public void OnAnimatorMove()
    {
      if (Time.deltaTime <= 0 || !Context.UpdateMovement) return;

        Vector3 nextPosition;
        Quaternion nextRotation;

        _aStarAi.MovementUpdate(Time.deltaTime, out nextPosition, out nextRotation);

        Vector3 position = Context.Animator.rootPosition;
        position.y = nextPosition.y;
        transform.position = position;

       _aStarAi.FinalizeMovement(Context.Animator.rootPosition, nextRotation);
    }

Edit:

I fixed it by changing the code a little bit

public void OnAnimatorMove()
    {
        if (Time.deltaTime <= 0 || !Context.UpdateMovement) return;

        Vector3 nextPosition;
        Quaternion nextRotation;

        _aStarAi.MovementUpdate(Time.deltaTime, out nextPosition, out nextRotation);

        _aStarAi.FinalizeMovement(new Vector3(Context.Animator.rootPosition.x, nextPosition.y, Context.Animator.rootPosition.z), nextRotation);


    }