A representation of a four-component vector.


struct SCNVector4


SceneKit uses four-component vectors to represent multiple kinds of data:

  • Axis-angle rotation or torque. The x, y, and z fields contain the normalized x-, y-, and z-components of the rotation axis, and the w field contains the rotation angle, in radians, or torque magnitude, in newton-meters.

  • Color value (or range). The x, y, z, and w fields contain the red, green, blue, and alpha components of the color, or the width of the color variation range in each component.



var x: Float

The first component in the vector.

var y: Float

The second component in the vector.

var z: Float

The third component in the vector.

var w: Float

The fourth component in the vector.

Converting Vector Types

func SCNVector4FromGLKVector4(GLKVector4) -> SCNVector4

Returns a four-element SceneKit vector structure corresponding to a GLKit vector structure.

func SCNVector4ToGLKVector4(SCNVector4) -> GLKVector4

Returns a four-element GLKit vector structure corresponding to a SceneKit vector structure.

Comparing Vectors

func SCNVector4EqualToVector4(SCNVector4, SCNVector4) -> Bool

Returns a Boolean value that indicates whether the corresponding components of two vectors are equal.

Zero Constant

let SCNVector4Zero: SCNVector4

The four-component vector whose every component is 0.0.

See Also


struct SCNVector3

A representation of a three-component vector.