Chung Hsuan Yeh
Chung Hsuan Yeh

Reputation: 23

Scenekit: Angle between two SCNNode

I am trying to develop a robotic arm tracking system. I used scenekit to develop the visualization and the control of the system. The SCNNodes of my system is:

Shoulder--->Upper_arm--->Fore_arm--->Palm.

I could now rotate each node using the rotation property of each SCNNode.

And I am now interested in whether there's any existing API to compute the angle between two SCNNode when the system is moving, eg. the angle between the Upper_arm and Fore_arm?

Upvotes: 1

Views: 1679

Answers (1)

Ef Dot
Ef Dot

Reputation: 768

Try SCNNode.eulerAngles, you will get SCNVector3, which has components:

  • Pitch (the x component) is the rotation about the node’s x-axis.
  • Yaw (the y component) is the rotation about the node’s y-axis.
  • Roll (the z component) is the rotation about the node’s z-axis.

Fore_arm.eulerAngles will give you rotation angles relative to Upper_arm

Upvotes: 1

Related Questions