I've created a particle system in the Scene Editor (not the particle Editor), and it's named "particles" (this is the default name).
Back in the ViewController, I'm attempting to get a reference to this particle system and change some properties of it.
But I can't figure out why this doesn't work:
let particleSystem = SCNParticleSystem(named: "particles", inDirectory: "")
particleSystem?.isAffectedByGravity = true
let particleSystems = scene.particleSystems
let myParticleSystem = particleSystems?
myParticleSystem?.isAffectedByGravity = true
Here is a picture of the scene I got:
And the code to get a reference to the particle system assigned to the particles SCNNode instance:
let particlesNode:SCNNode = scene.rootNode.childNodeWithName("particles", recursively: true)! let particleSystem:SCNParticleSystem = (particlesNode.particleSystems?.first)!