Path velocity doesn't update if path.canMove = false

Hey,

Just dropping this here for future searches. I learned that path.velocity stops updating if canMove is false and therefore stays at whatever it was last at. This can produce undesired results where the character isn’t moving but path.velocity still suggests it is. It can easily be worked around with something like this:

if(!path.canMove) { velocity = 0; } else { velocity = path.velocity.sqrMagnitude; }

SUGGESTION TO AUTHOR: It might be helpful to have path.velocity = Vector3.Zero when canMove is false so velocity is always accurate.

Anyway, hope this might help others in the future. Thx

Hi

SUGGESTION TO AUTHOR: It might be helpful to have path.velocity = Vector3.Zero when canMove is false so velocity is always accurate.

I can’t do that unfortunately. Often when canMove is false the use case is that you call the movement functions manually each frame. This would make the character move (and update its velocity) even if canMove is false.

No worries. Hopefully this is still helpful for anyone else that comes across this. :slight_smile: