Getting an SCNNode's bounding volume with rotation
<p>I have a very simple scene set up using the XCode level editor. </p>

<p><a href="https://i.stack.imgur.com/UhIMu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UhIMu.png" alt="enter image description here"></a></p>

<p>As you can see, one of the 1x5 rectangular cuboids has been rotated by 90º. This was achieved by setting the y attribute of the Euler Angles property to 90 in the Node Inspector. </p>

<p><a href="https://i.stack.imgur.com/PesD9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PesD9.png" alt="enter image description here"></a></p>

<p>But notice that the Bounding Box doesn't account for the cuboids rotation. This is also the case when I iterate through the SCNNodes in the scene. Both cuboids have the same Bounding Volumne</p>

<pre><code>for wall:SCNNode in walls.childNodes {
    var v1 = SCNVector3Zero
    var v2 = SCNVector3Zero
    wall.getBoundingBoxMin(&amp;v1, max:&amp;v2)
    print(v1, v2)
}

// Prints
// SCNVector3(x: -0.5, y: 0.0, z: -2.5) SCNVector3(x: 0.5, y: 0.5, z: 2.5)
// SCNVector3(x: -0.5, y: 0.0, z: -2.5) SCNVector3(x: 0.5, y: 0.5, z: 2.5)
</code></pre>

<p>So it seems the Bounding Volume is calculated using the child node's own coordinate system, not node parent's (or scene's) coordinate system. Which leaves me wondering; How do I calculate the SCNNodes bounding volume in the scene?</p>

<p>Looking through the documentation for SCNNode, it seems all the information is there. I can read the <code>eulerAngles</code> which gives me the correct rotation around the y axis. I can read the <code>transform</code> property. </p>

<p>I thought I might be able to multiply the vectors by the nodes transform matrix, but the transform matrix (4x4) and bounding box vectors (1x3) don't appear to be compatible. Nor does SceneKit appear to provide any methods for applying a transformation matrix to a vector. However, I'm not great with Geometry so I could be missing something obvious. </p>