Skip to content

Instantly share code, notes, and snippets.

View iwoj's full-sized avatar

Ian Wojtowicz iwoj

View GitHub Profile
@iwoj
iwoj / export-mesh.swift
Last active April 8, 2020 18:02 — forked from prcalopa/export-mesh.swift
Export mesh to obj file @ SceneKit
import SceneKit
import SceneKit.ModelIO
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
func exportMesh(_ geometry: SCNGeometry, withName name:String, useTimestamp:Bool = false){
// export geometry
let mesh = MDLMesh(scnGeometry: geometry)
let asset = MDLAsset(mesh.allocator)