简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM