Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

Scene Kit Tutorial with Swift Part 2: Nodes

In this 5-part Scene Kit tutorial series, you'll learn how to make your first 3D iOS game: a game like Fruit Ninja called Geometry Fighter!


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1260-scene-kit-tutorial-with-swift-part-2-nodes

very good explanation and step by step

This is so cool! I have to make some time to test this.
And because of this, the book must be amazing!

great tutorial. Very cool.
I’m having an issue setting the background image.
scnScene.background.contents = “GeometryFighter.scnassets/Textures/Background_Diffuse.png”
displays a black image not blue. Please advise.

1 Like

i have the same problem …

Same problem here. I resolved it by looking at the documentation for SCNScene. There is a Note saying “For best results, place scene files that ship in your app bundle in a folder with the .scnassets extension, and place image files referenced as textures from those scenes in an Asset Catalog…”
So - here’s what I did:

  1. Open Assets.xcassets and then drag Background_Diffuse.png into the asset list.
  2. Adjust the line in setupScene() so that it creates a new UIImage from that asset:
    scnScene.background.contents = UIImage(named: “Background_Diffuse”)

Run the app. It should show the blue background now. This worked for me.

4 Likes

This tutorial is more than six months old, so questions regarding it are no longer supported for the moment. We will update it as soon as possible. Thank you! :]