1
\$\begingroup\$

I don't understand why SCNNode's rotation property is a SCNVector4 instead of a SCNVector3. The documentation states that:

The four-component rotation vector specifies the direction of the rotation axis in the first three components and the angle of rotation (in radians) in the fourth. The default rotation is the zero vector, specifying no rotation. Rotation is applied relative to the node’s pivot property.

What's the fourth axis? I tried adding a light (SCNLight) and if I don't specify the value of the 4th float in the vector the light has no effect (the scene is dark). Why? shouldn't a 3-dimensional vector (x,y,z) be enough?

\$\endgroup\$
  • \$\begingroup\$ I'm confused, you seem to ask about 2 un-related topics. How to you set-up the light? \$\endgroup\$ – Alexandre Vaillancourt Feb 15 '16 at 15:45
1
\$\begingroup\$

As the documentation specifies, the first 3 values will specify the 3d position of the axis for rotating the light, while the 4th parameter will specify the rotation around that axis.

For instance, specifying (pseudo-code) (0, 0, 1, degToRad(45)) will have the effect of a light that will be rotated 45 degrees around the vertical axis (assuming that z is up), coming from the pivot location.

Now the fact that if you don't specify a value for the w (the 4th parameter), it does not light the scene, it might be related to the fact that your light is a directional light, or a spot, and the default 0 value lights in the opposite direction of where the scene is.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.