Get Started         Best Practices         Developer Guide         FAQ        

Load 3D models embedded into your app with CraftAR AR SDK

Last Updated: Apr 30, 2018
This article applies only to the Augmented Reality SDK.

The Augmented Reality SDK let's you render 3D models into the AR scene.
Those models can come from:
  • the online web content creator and downloaded automatically once the object is recognized; or
  • embedded into your app and loaded programmatically at runtime.
For both options, the Augmented Reality SDK provides means to know the status of the loading process.

This article describes how to load a 3D model that is embedded into the app on iOS and on Android. For 3D models downloaded from the cloud at run-time, you can read the separate dedicated article.
In order to add 3D model contents on top of the reference image programmatically is as easy as creating the 3D model with the name of the model stored in the resources of the application.  

Loading the embedded 3D model on Android

The following lines show how the content is created for a 3D model called “pizza.obj” using the Android Augmented Reality SDK:
 
String modelUrl = (getApplicationContext().getExternalFilesDir(null) + "/pizza.obj");
CraftARContent3dmodel modelContent = new CraftARContent3dmodel(modelUrl);
myARItem.addContent(modelContent)

In this case, the model has been added to the project inside the res/raw directory. The Android SDK takes care into copying resources in this folder to the external storage, if available.
Note: Eclipse is very restrictive about file names in the res folder. If you find issues adding your models there, you can compress them into a file named resources.zip. The SDK will uncompress that file when the application is ran for the first time.

Loading the embedded 3D model on iOS

The following lines show how the content is created for a 3D model called “pizza.obj” using the iOS Augmented Reality SDK:
 
CraftARTrackingContent3dModel* modelContent = [[CraftARTrackingContent3dModel alloc] initWithModelNamed:@"pizza" ofType:@"obj"];
[arItem addContent: modelContent];

Couldn't find what you were looking for?

support@catchoom.com
https://cdn.desk.com/
false
catchoom
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete