How to combine to two or more SCNGeometry / SCNNode into one

Viewed 3771

As if I would like to create some custom shape by combining some SCNBox and SCNPyramid etc, I can put them together by setting the right positions and geometries. How ever I just can not find a way to combine them as a single unit which can be modified or reacted in physical world. The code below that I would like create a simple house shape SCNNode, and I would like the node attached each other when affected by any collisions and gravity. Can anyone give some hints?

let boxGeo = SCNBox(width: 5, height: 5, length: 5, chamferRadius: 0)
    boxGeo.firstMaterial?.diffuse.contents = UIColor.blueColor()

    let box = SCNNode(geometry: boxGeo)
    box.position = SCNVector3Make(0, -2.5, 0)
    scene.rootNode.addChildNode(box)

    let pyramidGeo  = SCNPyramid(width: 7, height: 7, length: 7)
    pyramidGeo.firstMaterial?.diffuse.contents = UIColor.greenColor()

    let pyramid = SCNNode(geometry: pyramidGeo)
    pyramid.position = SCNVector3Make(0, 0, 0)
    scene.rootNode.addChildNode(pyramid)

enter image description here

2 Answers
Related