Scene Kit and 3D challenges for engineers
As our meet up presentation day was getting closer and closer, Erica and I did not have any topics in mind. Every team that presented did a great job, which left us not so many topics to choose from. After getting stressed out over this for a few days, we decided to work on Scene Kit as no other team worked on it. That is how our adventure with Scene Kit started… :-)
What we set out to do was to create a scene in Scene Kit where we would have a football and a goalie, shoot the ball and have the goalie catch it. After doing some research we realized that there is one big issue that is somewhat outside of our control, which is: finding usable 3D objects and animate them.
There are tons of websites to find free models. One of the things you need to pay attention to is the file type. XCode accepts Collada files, which have the “.dae” file extension.
After you download the file you want to use, and add it to your XCode project, you might realize that the model does not have the rotation value you need, so for example, if you have model that needs to stay straight on its feet, it may not when you add it into Xcode. An example below is an ironman model that I added into Xcode, look at how it looks in Xcode even though in the actual file it looks like it is standing:
The way we were able to fix this type of issues was to use some design software. We downloaded both Maya and Blender. With Maya’s help, we were able to fix the models and add them in to our Xcode project.
Because of that, it is important to understand that a Scene Kit project has at least two major teams working on it: the design team, that works on these models and animated objects, and the engineering team, that works on the coding aspects of things. In our case, we were trying to be both.
After adding the models in, the rest was the Scene Kit and iOS. This is not a Scene Kit project tutorial, so I will not go through the details, but here is the summary of it:
In Scene Kit, almost everything is a node; objects, floor, light, and camera. There is a rootnode, which is not visible and every other node is its child node. Every node has its parent node and its child nodes. Every node can have its material (mainly texture and its color/images), physics, geometry, light, camera, position, rotation, actions and many more other properties.
You start with adding nodes to your rootnode, and setting up your scene with lights, cameras, and all the glory!
P.S.: In case you might be wondering: yes, we finished our little scene and presented successfully!
I hope this helps someone!