Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the main difference between SCNVector3 and SCNVector3Make

I read the Apple's documentation about both classes but I am not quite sure when and when not to use which one? Since SCNVector3's constructor(s) also accept same parameters and return the same thing that's so confusing to have a method named SCNVector3Make

like image 951
Takasur Avatar asked Mar 08 '23 05:03

Takasur


1 Answers

SCNVector3Make is a convenience function, it is not a class.

SCNVector3 is a struct, not a class.

Either works if your x, y, and z values are Float.

let vector = SCNVector3(x, y, z)

or:

let vector = SCNVectorMake(x, y, z)

Both give you a SCNVector3 initialized with the 3 Float values.

If your values are other types (Int, Double, CGFloat), use the associated SCNVector3 initializer since SCNVector3Make only works with Float.

like image 135
rmaddy Avatar answered May 07 '23 07:05

rmaddy