简体   繁体   中英

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM