シーンとノード
boundingBox, boundingSphere
boundingBox
図形や立体を最小で囲む図形の箱(Storyboard
のTransformsでも見れる)
let (min, max) = hogeNode.boundingBox
//hogeNodeの幅を計算
let width = CGFloat(max.x - min.x)
//元の大きさ(boundingBox)の1/10にスケールする
let magnification = 0.1 * 1 / w
hogeNode.scale = SCNVector3(magnification, magnification, magnification)
boundingSphere
図形が変わっただけで考え方は同じ
->minが左下座標, maxが右上座標
・boundingBox - SCNBoundingVolume | Apple Developer Documentation
->centerが中心座標, radiusが(対象がギリギリで全部おさまる)半径
・boundingSphere - SCNBoundingVolume | Apple Developer Documentation
アニメーション
アニメーションはcoreAnimatonなど色々あるが
sceneKitではSCNAction
を使うのが一般的らしい
確かにシンプルで使いやすい感じ。
他参考
・iOS で SceneKit を試す(Swift 3) その16 - Scene Editor の Node Inspector - Apple Engine
->シリーズ90まであるので大変だけどこれ一通りやってしまえばSceneKitは攻略したもんだと思う、、、気がする