Reputation: 161
In my scenario, each SCNNode has 3 values associated with it for the roll, pitch, and yaw.
When I load the SCNNode, I want to apply these 3 rotations sequentially. However, these 3 values assume the axes of the node is always constant and I'm running into issues because the axes of the node change after each rotation.
For example, if the z-axis initially points towards the user (out of the screen) and the y-axis initially points up and I apply a 90 degree roll rotation then the z-axis will still point out of the screen but the y-axis will now point towards the left. Which will make the subsequent yaw rotation incorrect.
Is there some way to rotate the node relative to a constant set of axes?
Upvotes: 0
Views: 418
Reputation: 161
What I needed was the SCNNode method rotate(by:aroundTarget:)
https://developer.apple.com/documentation/scenekit/scnnode/2867399-rotate
Upvotes: 0