Skip to content

A small demo showing how to add 3D models in SceneKit for games or AR. Swift 4.

Notifications You must be signed in to change notification settings

p-sun/SceneKit-Model-Import

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SceneKit-Model-Import

A small demo showing how to add 3D models (.dae, .blend, .scn) in SceneKit for games or AR.

Where to find 3D models

You can find free VR/Low-poly models at

How to Import

.dae

  • Xcode an read this. Just drag it into your art.scnassets folder.

.blend

  • If the model in .blend format, open it in Blender, and export it as a .dae.
  • Create a folder in art.scnassets for your model(s) and texture(s)
  • Drag the .dae and the textures (.jpg or .png) into your folder
  • If there are textures, click the .dae scene, find the model you want, and select the texture image in the diffuse section of the model.
  • Add a the model as an SCNNode to your scene.
func rootNodeFromResource(assetName: String, extensionName: String) -> SCNNode {
    let url = Bundle.main.url(forResource: "art.scnassets/\(assetName)", withExtension: extensionName)!
    let node = SCNReferenceNode(url: url)!

    node.name = assetName
    node.load()
    return node
}

let potionsRoot = rootNodeFromResource(assetName: "potions/vzor", extensionName: "dae")
let potionNode = potionsRoot.childNode(withName: "small_health_poti_blue", recursively: true)!
scene.rootNode.addChildNode(potionNode)

textureFix

About

A small demo showing how to add 3D models in SceneKit for games or AR. Swift 4.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages