Within SceneKit I create a box and want to translate it along the y-axis, but I want all transforms to that box's node (translation, rotation, scaling) to not impact the original translation of the geometry. How can I accomplish this using SCNNode?
It is fairly simple to double wrap an object using an SCNNode
->SCNNode
->SCNGeometry
.
let planeBox = SCNBox(width: 50.0, height: 50.0, length: 1.0, chamferRadius: 0.0)
planeBox.firstMaterial?.diffuse.contents = UIColor(white: 0.0, alpha: 1.0)
let planeNode = SCNNode(geometry: planeBox)
planeNode = SCNMatrix4MakeTranslation(0.0, 50.0, 0.0)
let wrappingNode = SCNNode()
wrappingNode.addChildNode(planeNode)
scene.rootNode.addChildNode(wrappingNode)
Then all subsequent updates to the wrappingNode will be isolated from the original translation.