0

I wonder how to get the coordinates of a SCNNode in respect to the Device Reference (and not in respect to the World Reference)?

Thanks!

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
toto_tata
  • 14,526
  • 27
  • 108
  • 198
  • Possible duplicate of [ARKit - Get current position of 'camera' in scene](https://stackoverflow.com/questions/45084187/arkit-get-current-position-of-camera-in-scene) – Xartec Sep 28 '17 at 17:10

1 Answers1

0

An option could be to get the position of the ARCamera node. You could do this by looping through all the child nodes until you find the ARCamera (or possibly using the ARSCNView's pointOfView method, not sure about this one).

Once you find the camera you can store it into a SCNNode type variable, then you would basically need to get the difference in positions between the two. You could do something like:

SCNVector3Make(cameraNode.x - targetNode.x, 
               cameraNode.y - targetNode.y, 
               cameraNode.z - targetNode.z);
Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
Alan
  • 1,132
  • 7
  • 15