Note that this uses another extension on CGFloat
(also included here) to wrap values greater than CGFloat.pi
.
let (scenePosition, sceneRotation) = self.getPositionAndRotation(within: self.scene!)
Consider the following node tree somewhere within the scene:
commonAncestor
|> grandParent1
|> parent1
|> child1
|> parent2
|> child2
let child1Rotation = child1.getRotation(within: commonAncestor)
let child2Rotation = child2.getRotation(within: commonAncestor)
let rotationDifference = child2Rotation - child1Rotation