us895649
us895649

Reputation: 13

How to add 3D model to SceneKit?

Using SketchUp, I made a DAE file, with a basic shape which has a few textures too.

The DAE file also comes with a folder the contains those textures. I also am using SceneKit and have an existing scene, camera, light etc. I at the moment, I render many cubes into certain positions. How can I render the DAE model instead of the cube?

Cheers.

Upvotes: 1

Views: 1688

Answers (1)

Pro Blaster
Pro Blaster

Reputation: 491

It's sure possible but please note that I am in objective C not swift(sorry).

Here is the code (Objective C but it's pretty easy to translate):

SCNScene *somthing = [SCNScene sceneNamed:@"mySketchupScene.dae"];

Now, when you import the DAE (we'll be calling it by it's real name Collada from here on out) into your app resources or .scnassets (perhaps by click-dragging) make sure that you first import the texture folder, then import the Collada.

I found that if you don't do the textures first, then Xcode messes up the matireals and you have to go manually re-assign all the textures.

Upvotes: 2

Related Questions