I am using SceneKit on Mac OS X to load a COLLADA (DAE) file containing an animated object.
let modelNode = SCNNode()
modelNode.name = "ModelNode"
let modelScene = SCNScene(named: "art.scnassets/obj/Spiderman.dae")
if let childNodes = modelScene?.rootNode.childNodes {
for childNode in childNodes {
modelNode.addChildNode(childNode as SCNNode)
}
}
let modelNodeArmature = modelNode.childNodeWithName("Armature", recursively: true)
I then apply an action to animate the object which is then rendered. I would then like to get access to the modified geometry (i.e. the vertices). I tried doing the following:
let armatureGeometry = modelNodeArmature?.geometry!.geometryElementAtIndex(0)
let geometryData = NSData(data: armatureGeometry!.data)
However, when I compare the animated geometry to the original one, I find that the data has not changed. I have also read that only the SceneKit renderer applies the necessary transformations to render the geometry, and the original is left as is:
http://stackoverflow.com/questions/29533199/scenekit-how-to-update-scngeometrysource?rq=1
Is there another way that I can access the updated geometry? In particular, I want to extract the animated vertices.