MoveTo() finishing immediately when colliding with geometry

I’m having some trouble with a flying AI I’m working on.

I’m using MoveTo() to move the bot to each new location. However it seems whenever it collides with geometry, the MoveTo() latent function ends immediately.

I was under the impression that MoveTo() simply calculates the time it expects to traverse the distance and terminates on a timer for this time.

Anyone know why this is terminating when it touches geometry?

I have solved this by wrapping my MoveTo()'s with my own two functions that calculate the estimated fly time, and sleeps for any delta time left over after MoveTo() has terminated.

Bit of a hack, but seems to work perfectly. This is the code in case it can ever help anyone:



//Within the controller state code:

StartFlyMoveTo(toLoc, 100);
MoveTo(toLoc,, 100);
Sleep(EndFlyMoveTo());




function StartFlyMoveTo(vector toDest, optional int movePrecision)
{
    local float distToDest;

    FlyMoveToTimeStarted = WorldInfo.TimeSeconds;
    FlyMoveToDuration = 0;
    distToDest = DistBetween(Pawn.Location, toDest) - movePrecision;

    if (distToDest > 0 && Pawn.AirSpeed > 0) {
        FlyMoveToDuration = distToDest / Pawn.AirSpeed;
    }
}
function float EndFlyMoveTo()
{
    local float expectedTimeRemaining;
    local float moveTimeElapsed;
    moveTimeElapsed = WorldInfo.TimeSeconds - FlyMoveToTimeStarted;
    expectedTimeRemaining = FlyMoveToDuration - moveTimeElapsed;
    if (expectedTimeRemaining > 0) {
        return expectedTimeRemaining;
    }
    return 0.0;
}