2
\$\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\$
1
  • \$\begingroup\$ I'm confused, you seem to ask about 2 un-related topics. How to you set-up the light? \$\endgroup\$ Commented Feb 15, 2016 at 15:45

1 Answer 1

2
\$\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\$
1
  • 1
    \$\begingroup\$ Side-note: In SceneKit, Y is up and Z is forward. \$\endgroup\$ Commented Apr 7, 2020 at 9:41

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.