The problem is that distRemaining is always constant due to being assigned using the "linear" variable. The solution is to change line 738
double distRemaining = sqrt(linear.x() * linear.x() + linear.y() * linear.y());
to
double distRemaining = sqrt(remaining.x() * remaining.x() + remaining.y() * remaining.y());
The problem is that distRemaining is always constant due to being assigned using the "linear" variable. The solution is to change line 738
double distRemaining = sqrt(linear.x() * linear.x() + linear.y() * linear.y());
todouble distRemaining = sqrt(remaining.x() * remaining.x() + remaining.y() * remaining.y());
The solution is tested and works fully.