@Override
	public void controlObject(GObject target, Context context) {
		// Can we control the target?
		if (!canControl(target, context)) {
			previousTransforms.clear();
			return;
		}

		// Perform the calculation.
		// (This is an abstract method delegated to subclasses.)
		Point2D transform = calculateControl(target, context);

		// Create variables.
		final double dx = transform.getX();
		final double dy = transform.getY();

		// Move the object.
		target.setX(target.getX() + dx);
		target.setY(target.getY() + dy);

		// Did we move, and should we rotate?
		if (isRotateToFollow() && (dx != 0 || dy != 0)) {

			// Add this transform to the list.
			previousTransforms.add(transform);

			// If we're too long...
			if (previousTransforms.size() > getMovingAverageCount()) {
				// ... take off the front.
				previousTransforms.remove(0);
			}

			// Define starting average points.
			double newDx = 0, newDy = 0;

			// Calculate the average transform...
			for (Point2D point : previousTransforms) {
				// Increment totals.
				newDx += point.getX();
				newDy += point.getY();
			}

			// Then rotate.
			target.setRotation(Math.toDegrees(Math.atan2(newDy, newDx))
					+ rotationOffset);
		}
	}