Kodeco Forums

Scene Kit Tutorial with Swift Part 5: Particle Systems

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/1255-scene-kit-tutorial-with-swift-part-5-particle-systems

You should stop to unwrap your optionals in instance properties. This is bad style and people will use it. Assigning the node to a let value before adding it as a child and then assign this to the property does not hurt and will save trouble if a node or a view or something “get`s lost” or something. Calling variable?.method() instead of variable.method() should not be a problem.

Or, perhaps better, use a lazy var declaration. These properties aren’t meant to be optionals at all, but they can’t be initialised in init(coder:) either, so a lazy var might be better than an implicitly unwrapped optional.

As always, amazing work. I always thought that I was never going to have this knowledge, looking to another else’s app. Can’t wait to read the whole book.

hi,

Very nice tutorial… There’s a little bit of “juice” that I’m very interested in implementing, but I cannot seem to find an easy way to do it… I’m thinking there IS an easy way though…

I’m talking about a high frame rate “slow motion” effect… seen in games like alto and badlands… they slow time down but the frame rate remains at 60fps…

i’m interested also in an effect that I saw in inception…

where different time flow worlds exist simultaneously…

can there be n physics worlds, each with their own times? can objects have different times? for example player behaves at normal speed, but the surroundings behave in super slow motion? or even at various speeds of their own?

hmm

Hi there,

You can definitely achieve a similar effect by manipulating the speedFactor property of the SCNParticleSystem. The cool part about this property is the fact that it can be animated with SCNTransation/CABasicAnimation. So you can start the speedFactor at 2.0, then animate it down to 0.5 for example.

Note that this speed manipulation is done all independently of the game scene itself, thus your game will continue to run at 60fps at all times.

For more detail, check out the SceneKit Framework Reference: SCNParticleSystem.speedFactor

Good luck!

oh cool! thanks! thats one part of the puzzle… so what about on all of certain categories of objects as opposed to just whatever is in any particular particle emitter? for example what if i wanted the player to move normally, yet the objects around him are all in super slow motion, for example…

hi, I’ve got the book and am trying to move on but in the book it refers to resources. Where can i obtain these resources.

thanks in advance

Super Tutorial. I’ve learned a tone in a short space of time. Hoping to learn as much SceneKit that I can to implement some ideas for ARKit. Also I have uploaded the final project compiled fine for Swift 3/4 to GitHub here if anyone finds this useful! https://github.com/my-mo/GeomtryFighter.git

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! :]