Help with SCNNode rotations

I am trying to create a node in a scene that tracks the motion of the mobile device. I have a SCCone node in my scene that has the pointy end anchored at a particular spot in the scene (by setting the position and then pivoting 1/2 the height of the cone). I’d like to have the wide end of the cone point towards the spot that the z-axis of the mobile device is pointing to.


I have used the CMMotionManager to get an altitude and azimuth of the device in radians.


I’m trying to wrap my head around how to rotate the node to match the device orientation. The azimuth seems straightforward and if I assign


coneNode.eulerAngles = SCNVector3(0, 0, azimuth)


then the cone moves in a 360º circle as you pan the device in 360º.


However, I don’t know how to set the x and y rotation to display the altitude. Can anyone explain the secret sauce?