Transferring in some scene kit code I use. Nothing is tested yet, probably doesn't work