Turning SceneKit node from a DAE file into physics body

Viewed 157

I have a SceneKit node that has child geometries as defined in the dae file that I downloaded. Currently, when I run this code, the geometries are obviously off, as I notice when things collide the node. The node has a cup-like shape.

let shape = SCNPhysicsShape(node: node, options: [SCNPhysicsShape.Option.keepAsCompound: true])

My end goal is to get the geometries of the the dae file, create a physics shape and then detect collisions with the physics shape. Any ideas on what to do?

1 Answers

Create a flattenedClone() from your Node (entire DAE Node-Tree), then use that Geometry Object as the Shape for the Physics Body of your Node.

Related