vvolynine
03-13-2012, 10:09 PM
This is the piece of code:
if( FindNavMeshPath() )
{
NavigationHandle.SetFinalDestination(NavigationDes tination);
FlushPersistentDebugLines();
NavigationHandle.DrawPathCache(,TRUE);
while( Pawn != None && !Pawn.ReachedPoint(NavigationDestination, None) )
{
if( NavigationHandle.PointReachable( NavigationDestination ) )
{
MoveTo( NavigationDestination, None, , true );
}
else
{
if( NavigationHandle.GetNextMoveLocation( TempDest, Pawn.GetCollisionRadius()) )
{
if (!NavigationHandle.SuggestMovePreparation( TempDest,self))
{
MoveTo( TempDest, None, , true );
}
}
}
DistanceCheck.X = NavigationDestination.X - Pawn.Location.X;
DistanceCheck.Y = NavigationDestination.Y - Pawn.Location.Y;
DistanceRemaining = Sqrt((DistanceCheck.X*DistanceCheck.X) + (DistanceCheck.Y*DistanceCheck.Y));
GotToDest = Pawn.ReachedPoint(NavigationDestination, None);
if( DistanceRemaining < 15) break;
}
}
the while loop, quite often, at totally random occasions (whether I spam to move my pawn or click once and wait) will get stuck and shoot off a million iterations of itself and crash UDK, any suggestions or errors you see in this?
if( FindNavMeshPath() )
{
NavigationHandle.SetFinalDestination(NavigationDes tination);
FlushPersistentDebugLines();
NavigationHandle.DrawPathCache(,TRUE);
while( Pawn != None && !Pawn.ReachedPoint(NavigationDestination, None) )
{
if( NavigationHandle.PointReachable( NavigationDestination ) )
{
MoveTo( NavigationDestination, None, , true );
}
else
{
if( NavigationHandle.GetNextMoveLocation( TempDest, Pawn.GetCollisionRadius()) )
{
if (!NavigationHandle.SuggestMovePreparation( TempDest,self))
{
MoveTo( TempDest, None, , true );
}
}
}
DistanceCheck.X = NavigationDestination.X - Pawn.Location.X;
DistanceCheck.Y = NavigationDestination.Y - Pawn.Location.Y;
DistanceRemaining = Sqrt((DistanceCheck.X*DistanceCheck.X) + (DistanceCheck.Y*DistanceCheck.Y));
GotToDest = Pawn.ReachedPoint(NavigationDestination, None);
if( DistanceRemaining < 15) break;
}
}
the while loop, quite often, at totally random occasions (whether I spam to move my pawn or click once and wait) will get stuck and shoot off a million iterations of itself and crash UDK, any suggestions or errors you see in this?