Game Development Reference
In-Depth Information
This is usually used to describe node positions; however, you
should be aware of the context in which it is being used.
func SCNVector4(x:Float, y:Float, z:Float, w:Float) -> SCNVector4
func SCNVector4Make(x:Float, y:Float, z:Float, w:Float) -> SCNVector4
This data structure can be used to represent a color value or as a
way to rotate an object.
Creating matrices is relatively straightforward, and they allow you to transform (move, ro-
tate, and so on) an object within the 3D space.
func SCNMatrix4MakeTranslation(x:Float, y:Float, z:Float) -> SCNMat-
rix4
The variables are distances you want the object to be moved
along the associated axis.
func SCNMatrix4MakeRotation(angle:Float, x:Float, y:Float, z:Float) ->
SCNMatrix4
The angle in this function is in radians and counterclockwise
around the rotation axis (which is the x-, y-, z-coordinates you
supply).
func SCNMatrix4MakeScale( sx:Float, sy:Float, sz:Float) -> SCNMatrix4
The variables represent the scale factor you want to change the
object along that axis.
Now that I have reviewed the ways in which you create these elements, Scene Kit
provides you with some ways to perform operations on them.
func SCNMatrix4Translate(mat:SCNMatrix4, x:Float, y:Float, z:Float) ->
SCNMatrix4
This is used to add a matrix to a specified matrix with a trans-
formation.
mat is combined with the translation (x, y, z) directions.
func SCNMatrix4Rotate(mat:SCNMatrix4, angle:Float, x:Float, y:Float,
z:Float) -> SCNMatrix4
Search WWH ::




Custom Search