Scene Kit sample code

I just found out from Peter Hosey that sample code for Scene Kit is publicly available. There are three example projects:

  • Scene Kit Document Viewer
    • Shows basic features of SCNView.
    • Demonstrates hit testing. When you click on an object in the scene, the object is highlighted with a pulsating blue glow.
    • Demonstrates SCNView's built-in ability to pan, zoom, and rotate the scene in response to dragging the mouse.
    • Subclass of SCNView allows you to drag and drop an arbitrary .dae file into the scene view.
    • This is the project I referred to in my earlier post about redistributing Apple's sample code. This public version of the project is different in some minor but noticeable ways from the version I mentioned, which is behind a developer login.
  • Scene Kit Animations
    • Shows how to apply different animations to a scene.
    • Displays a row of buttons for selecting which animation to apply. I found that these buttons were hidden behind the scene view, and I had to rearrange things in the nib to make the buttons visible. I've reported this as rdar://12082268.
  • Scene Kit Material Editor
    • Shows how to fiddle with materials.
    • Provides a UI for tweaking attributes of materials and applying the materials to different shapes.
    • Also shows how to create simple 3D shapes programmatically — something I happened to be wondering about.

These projects all use modern Xcode stuff like ARC, collection literals, and (in two of the three) Auto Layout. Note that Scene Kit requires Mountain Lion.

As of this moment, Googling for "scene kit sample code site:developer.apple.com" still doesn't find these examples, which I find odd, since they've been available for a good ten days. The Scene Kit API docs don't point to the examples yet, but this is less surprising; I'm sure the docs will be updated in good time.

A quick way to find these examples is by going to the Mac Developer Library and entering "scene kit sample code" in the search field next to where it says "Documents" (not the field at the top right corner of the page). Using "sample code" in the search terms is a good way in general to find example projects.

Scene Kit sample code

3 thoughts on “Scene Kit sample code

  1. Pingback: Michael Tsai - Blog - Scene Kit Sample Code

  2. Pingback: June 2012 — belated recap | CocoaHeadsNYC

  3. Pingback: August 2012 — Natalie and David | CocoaHeadsNYC

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.