private void projectUntilCrossWaveSmoothing (Projection proj, Rectangle2D safeBF, int direction) {
		double startingBearing = proj.getBearingOffset();
		
		boolean found = false;
		double stickLenght = 160;
		
		
		for (int t = 1; t < 200 && !found; t++) {
			tickProjection tick = proj.projectNextTick();
			
			double directionHeading = proj.getWantedDirection() == 1 ? tick.getHeading() : tick.getHeading() + 180;
			Rectangle2D collisionBox = new Rectangle2D.Double(tick.getPosition().getX() - 80, tick.getPosition().getY() - 80, 160, 160);
			
			if (!safeBF.contains(tick.getPosition().getX()-80, tick.getPosition().getY()-80, 160, 160)) {
				double xend=tick.getPosition().getX() + Math.sin(Math.toRadians(directionHeading))*stickLenght;
				double yend=tick.getPosition().getY()+ Math.cos(Math.toRadians(directionHeading))*stickLenght;				
				
				if (!safeBF.contains(xend, yend)) {
					proj.setTurningAdjustment(direction * 5.);
				}
			}
			
			if (tick.getPosition().distance(firingPosition) <  bulletVelocity * t) {
				found = true;
			}
			//hit a wall
			if (!safeBF.contains(tick.getPosition())){
				found = true;
			}
		}
		
		
	}