AIPath.steeringTarget doesn't update

Please help :slight_smile:
I’m trying to do a rootmotion with AIPath and the problem is I need to calculate a desiredVelocity , that actually always if use AIPath.desiredVelocity, Im trying to do it like that

        Vector3   desiredVelocity = (a_Unit.Agent.steeringTarget - a_Unit.m_transform.position).normalized;

        Vector3 velocity = Quaternion.Inverse(a_Unit.m_transform.rotation) * desiredVelocity;

        float angle = Mathf.Atan2(velocity.x, velocity.z) * S_Number.angle180 / Mathf.PI;

        locomotion.Do(velocity.magnitude, angle, distanceToDestination);

Everything is fine except steeringTarget, it always stuck on first or nearest point and never reach just walking around even if I set PickNextWayPoint to some very big number.


Have you possibly disabled ai.canMove or something like that?

yes, that what I did

Then it will not update those variables anymore. If you turn off canMove it will skip those calculations for performance reasons.

If you want to override the movement completely you could follow the example here:

Also, you might be interested in checking out the script called MecanimBridge in the project. It is not implemented in any example scene yet, but it shows how to get rudimentary root motion working.

Thank you Aron, that’s very helpful!