I'm using a 'move towards' action on a walking enemy and would like to know when this enemy is stuck behind a collider. The problem is the walk animation continues because the 'move towards' target is on the other side of the collider and never finishes. The collider pushes back momentum, negating the enemy walk speed.
In most cases the enemy walks around the collider, meets the target and idles but not always. I can't simply detect a collider and trigger an idle, because often times you walk along side other enemies and I don't want them stopping every time they get close.
I'm thinking the best work around is to determine speed during the move towards action. I could do a compare and exit state when it's 0. I tried 'get velocity' with no luck. I have a rigid body attached. Using gravity is the only way I can get any variable beyond 0.
I could get the distance to target, but then how do I reference lapsed time? Maybe I need to make a separate FSM (trying to avoid that) that receives the distance variable. Then between two states I can subtract distance and determine time past. But I'd prefer to have the compare happen inside the same state as the 'move towards'.