title: Assimp : import camera
body: <p>I'm using the assimp library to import some FBX model, but I can't find a way to correctly retrieve the camera coordinates!</p>
  
  <p>Does someone has experience with this ?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    // Find the transformation matrix corresponding to the camera node
  aiNode* rootNode = _assimpScene-&gt;mRootNode;
  aiNode* cameraNode = rootNode-&gt;FindNode(assimpCamera-&gt;mName.data);
  
  aiMatrix4x4 T;
  while(cameraNode != rootNode)
  {
      T = cameraNode-&gt;mTransformation * T;
      cameraNode = cameraNode-&gt;mParent;
  }
  
  aiMatrix4x4 R = T;
  R.a4 = R.b4 = R.c4 = 0.f;
  R.d4 = 1.f;
  
  // Transform
  aiVector3D from = T * assimpCamera-&gt;mPosition;
  aiVector3D up = R * assimpCamera-&gt;mUp;
  aiVector3D lookAt = R * assimpCamera-&gt;mLookAt;
  
  // Set up the camera
  camera-&gt;eyeFrom = luxrays::Point(from.x, from.y, from.z);
  
  lookAt = lookAt.Normalize();
  camera-&gt;eyeAt = luxrays::Point(from.x + lookAt.x, from.y + lookAt.y, from.z + lookAt.z);
  
  up = up.Normalize();
  camera-&gt;eyeUp = luxrays::Point(up.x, up.y, up.z);
  </code></pre>