title: Camera is not following the airplane in Scenekit
body: <p>I have a flying aircraft which I am following and I am also showing the path the aircraft has followed. I am drawing cylinders as a line for drawing the path. Its kind of drawing a line between 2 points. I have a cameraNode which is set to (0,200,200) initially. At that point I can see the aircraft. But when I start my flight. It goes out of the screen. I want 2 things :</p>
  
  <ol>
  <li>Follow just the aircraft (Path won't matter).</li>
  <li>Show whole path and also the aircraft.</li>
  </ol>
  
  <p>I tried finding the min ad max x,y and z and taking average but it din't work. If you see below gif its too zoomed and aircraft has moved out of the screen
  <a href="https://i.stack.imgur.com/kuvFb.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/kuvFb.gif" alt=""></a></p>
  
  <p>Here is how I set my camera:</p>
  
  <pre><code>- (void)setUpCamera {
  SCNScene *workingScene = [self getWorkingScene];
  _cameraNode = [[SCNNode alloc] init];
  _cameraNode.camera = [SCNCamera camera];
  _cameraNode.camera.zFar = 500;
  _cameraNode.position = SCNVector3Make(0, 60, 50);
  [workingScene.rootNode addChildNode:_cameraNode];
  
  SCNNode *frontCameraNode = [SCNNode node];
  frontCameraNode.position = SCNVector3Make(0, 100, 50);
  frontCameraNode.camera = [SCNCamera camera];
  frontCameraNode.camera.xFov = 75;
  frontCameraNode.camera.zFar = 500;
  [_assetActivity addChildNode:frontCameraNode]; //_assetActivity is the aircraft node.
  </code></pre>
  
  <p>} </p>
  
  <p>Here is how I am changing camera position which is not working:</p>
  
  <pre><code>- (void)showRealTimeFlightPath {
  
  
  DAL3DPoint *point = [self.aircraftLocation convertCooridnateTo3DPoint];
  DAL3DPoint *previousPoint = [self.previousAircraftLocation convertCooridnateTo3DPoint];
  self.minCoordinate = [self.minCoordinate findMinPoint:self.minCoordinate currentPoint:point];
  self.maxCoordinate = [self.minCoordinate findMaxPoint:self.maxCoordinate currentPoint:point];
  DAL3DPoint *averagePoint = [[DAL3DPoint alloc] init];
  averagePoint = [averagePoint averageBetweenCoordiantes:self.minCoordinate maxPoint:self.maxCoordinate];
  
  SCNVector3 positions[] = {
      SCNVector3Make(point.x,point.y,point.z) ,
      SCNVector3Make(previousPoint.x,previousPoint.y,previousPoint.z)
  };
  SCNScene *workingScene = [self getWorkingScene];
  DALLineNode *lineNodeA = [[DALLineNode alloc] init];
  [lineNodeA init:workingScene.rootNode v1:positions[0] v2:positions[1] radius:0.1 radSegementCount:6 lineColor:[UIColor greenColor]] ;
  [workingScene.rootNode addChildNode:lineNodeA];
  self.previousAircraftLocation = [self.aircraftLocation mutableCopy];
  self.cameraNode.position = SCNVector3Make(averagePoint.x, averagePoint.y, z);
  self.pointOfView = self.cameraNode;
  </code></pre>
  
  <p>}</p>
  
  <p>Code in swift or objective c are welcomed. </p>
  
  <p>Thanks!!</p>