moveToTarget method

void moveToTarget(
  1. double delta
)

Implementation

void moveToTarget(double delta) {
  var distance = position.distanceTo(target);
  distance += delta;

  if (distance <= 0) {
    distance = 0.001;
  }

  final forward = this.forward;
  position.setValues(
    target.x + (forward.x * -distance),
    target.y + (forward.y * -distance),
    target.z + (forward.z * -distance),
  );
}