I am learning how to play with SceneKit, and I am deeply confused with methods/properties that involve a SCNVector4
, such as SCNPhysicsBody.applyTorque
and SCNNode.rotation
. Apparently, you can express a rotation of a 3D object with just 4 values. I do not understand why this is at all.
I searched online for "express 3d rotation with 4d vector" and found lots of stuff about rotations in 4D space, which is not what I want. I also see a lot of webpages that talk about sin and cos, but I failed to understand what they mean. My knowledge of sin and cos is only limited to finding the angles/side lengths of right angled triangles.
In my mind, a rotation of a 3D object needs to be expressed with 7 values i.e. a 7D vector:
- 3 values for the position of one end of the rotation axis
- 3 values for the position of the other end of the rotation axis
- 1 value for the angle you rotate by
I think that I understood 2D rotation in SpriteKit pretty well: each node has an anchor point and so the rotation property is just how many radians about the anchor. However, I can't find such an anchor point in SCNNode
. When I look up "anchor point scnnode" I get stuff about ARSCNNode
which is not what I want.
I also looked at this, which says:
The x-, y- and z-components determine the rotation axis, while the w-component determines the rotation angle, that is, the magnitude of the torque.
How can just the x, y, z components specify the rotation axis?
Can you explain how I can wrap my head around this craziness?
applyTorque
method takes aSCNVector4
. This is what I am trying to understand. – Sweeper