Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where's the particle system file in SceneKit in Xcode 11.3.1

Recently I updated my Xcode to 11.3.1. But while working with SceneKit, I found that I can't create a particle system file.

  • Before

Before

  • After

After

How can I create a particle system in a file now?

like image 626
xiaoyu2006 Avatar asked Jan 21 '20 07:01

xiaoyu2006


3 Answers

SceneKit Library

In Xcode 13 / 12 / 11 you have no preconfigured .scnp particle system files anymore. Instead, you can use a Particle System object coming from a Xcode Library (with the same settings in Attributes Inspector as they were in Xcode 10).

enter image description here

If you manually placed a Particle System from library into SceneKit's Scene graph you can then retrieve it and setup programmatically. Let's see how it looks like:

let particlesNode = sceneView.scene?.rootNode.childNode(withName: "particles", 
                                                     recursively: true)

particlesNode?.particleSystems?.first?.isAffectedByGravity = true
particlesNode?.particleSystems?.first?.acceleration.z = 5.0


Creating particles programmatically

Or you can easily create a Particle System from scratch using just code:

let particleSystem = SCNParticleSystem()
    
particleSystem.birthRate = 1000
particleSystem.particleSize = 1.45
particleSystem.particleLifeSpan = 2
particleSystem.particleColor = .yellow

let particlesNode = SCNNode()
particlesNode.addParticleSystem(particleSystem)

sceneView.scene!.rootNode.addChildNode(particlesNode)

Creating .scnz file containing Particle System

  • Select a .scn file in Project Navigator (left pane) and choose File – Export...
  • In drop-down menu choose Compressed Scenekit Scene Document .scnz

enter image description here

Or you can create .scnp file by renaming .scn – the same way @ycao proposed.

like image 71
Andy Jazz Avatar answered Nov 20 '22 16:11

Andy Jazz


Particle System moved to Scene Kit Scene File as a library object:

Particle System in Library

like image 39
Vladislav Kulikov Avatar answered Nov 20 '22 16:11

Vladislav Kulikov


While creating a new file, select SceneKit SceneFile. Edit the suffix to .scnp, and everything is OK.

like image 2
xiaoyu2006 Avatar answered Nov 20 '22 15:11

xiaoyu2006