Hi! I’m very excited about your project and definitely going to use it in my game!
But it looks that I found a bug. After moving from Unity Navigation to A*Project I noticed that my agents move little bit slower. Also their speed is inconsistent - when they are crossing open area where nothing can stop them they often have micro drag or, vice versa, micro acceleration. So they go a little bit faster then a little bit slower, then again a little bit faster… These changes in speed are subtle, but still noticeable.
And it looks that I found a reason. I use Grid Graph and AIPath in 2D. Also my agents have Rigidbody2D and its Interpolate setting is set to “Interpolate”. There is an undocumented feature about this setting. If it’s set to “None”, then transform.position and rigidbody2D.position are exactly the same (as expected). But if it’s set to “Interpolate” or “Extrapolate”, then transform.position != rigidbody2D.position. This is because transform.position has some kind of interpolated value. And that is the reason why it can not be used as a source position for calculating target position. The rigid2D.position should be used instead. Or, in terms of code:
void FixedUpdate()
{
Vector2 offset = …
// rigid2D.MovePosition( transform.position + offset ); // Bug
rigid2D.MovePosition( rigid2D.position + offset ); // OK
}
But in the AIPath.MovementUpdateInternal( … ) method there is a line:
simulatedPosition = tr.position;
And all speed inconstancy dissappeared after I changed it to:
simulatedPosition = rigid2D.position;
Can it be treated as a bug?
I haven’t found any documentation about transform.position and rigidbody2D.position differences. But found these 2 answers:
https://forum.unity.com/threads/best-way-to-get-rigidbody-position.526654/