Last active
August 12, 2019 20:16
-
-
Save eospi/55082a7a9f3a458501b3dbc8d83e1316 to your computer and use it in GitHub Desktop.
RealityKit Synchronous Loading
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func loadEntitySync() { | |
// Create an world anchor at the origin and add it to the scene | |
let anchor = AnchorEntity(world: [0,0,0]) | |
arView.scene.addAnchor(anchor) | |
// Handle errors in case the file doesn't exist | |
do { | |
let usdzPath = "path/to/usdz/asset" | |
let modelEntity = try ModelEntity.loadModel(named: usdzPath) | |
anchor.addChild(modelEntity) | |
} catch { | |
print("file not found") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment