title: Position SCNNode in front of camera with just one axis of rotation
body: <p>I'm trying to make an ARKit application where an SCNNode, in this case a box, is placed in front of the camera, facing the camera. As the user moves the camera around, objects are placed when a certain distance has been moved. This would leave you with a series of nodes facing the camera in a line, equally spaced.</p>
  
  <p>I have this working to a certain extent, but my problem is with the rotation. I'm currently taking all axes of rotation, so as the user re-orients their phone, the rotation of the node matches. I want to restrict this to just the rotation around the y-axis. The ideal outcome is a domino-trail like look, with all the objects having the same x and z rotations, but potentially different y rotations.</p>
  
  <p>I hope I've explained this clearly enough!</p>
  
  <p>Here's the code I'm currently using:</p>
  
  <pre><code>func createNode(fromCameraTransform cameraTransform: matrix_float4x4) -&gt; SCNNode {
      let geometry = SCNBox(width: 0.02, height: 0.04, length: 0.01, chamferRadius: 0)
  
      let physicsBody = SCNPhysicsBody(type: .dynamic, shape: SCNPhysicsShape(geometry: geometry))
      physicsBody.mass = 1000
  
      let node = SCNNode(geometry: geometry)
      node.physicsBody = physicsBody
  
      var translationMatrix = matrix_identity_float4x4
      translationMatrix.columns.3.x = 0.05  // Moves the node down in world space
      translationMatrix.columns.3.z = -0.1  // Moves the object away from the camera
  
      node.simdTransform = simd_mul(cameraTransform, translationMatrix)
  
      return node
  }
  </code></pre>
  
  <p>I've tried different combinations of extracting values from the second column of the <code>cameraTransform</code> and setting them as <code>eulerAngles</code>, <code>rotation</code> and <code>simdRotation</code>, but to no avail.</p>
  
  <p>I've also tried extracting values from the <code>pointOfView</code> of the current <code>sceneView</code> and assigning them to the same values as listed above, but again, no luck.</p>
  
  <p>Any help would greatly appreciated!</p>
  
  <p>I know a little bit about this, but am really just starting out with SceneKit and 3D transformations/matrices so be gentle with me!</p>