Game Development Reference
In-Depth Information
SCNPyramid : This is a geometric feature of right triangles.
When initializing an SCNPyramid , you give the height, width, and length
for the pyramid.
SCNSphere : This is a geometric shape of a globe. When instan-
tiating an SCNSphere , you provide the radius to be used for the
SCNSphere .
SCNTorus : A torus is simply a circle around a coplanar axis.
You provide an inner radius and an outer radius for its circles.
SCNTube : This is a tube or pipe. You give it an inner radius, an
outer radius, and the height for the tube.
SCNShape : This geometric shape is created from a Bezier path.
SCNShape gives you the most control over the shape of your 3D object.
SCNText : You provide an NSString or NSAttributedString that is
used to create a 3D object from this string.
As you can see, Apple has provided you with most of the shapes you will need. You can
combine these primitive shapes to create complex objects. However, for this game, you
will stick to the basic primitives for now. Let's get back into the code and start adding
some obstacles for the spaceman to maneuver around in order to find the enemy.
Adding Obstacles
Create a new Swift file and name it Obstacles.swift . In the newly created file, you
first want to import the Scene Kit framework so that you can use the Scene Kit library.
You will do a few things differently in this class, in that you will create class-level meth-
ods. If you are familiar with other languages, this is similar to static methods.
Search WWH ::




Custom Search