Explosion of 3D Text with Particle System (Swift - SceneKit)

I am making an explosive 3D text with Swift SceneKit. Here is the text:

let text = SCNText(string: "Exploding Text", extrusionDepth: 5) let node = SCNNode(geometry: SCNText) scene.rootNode.addChildNode(node) 

and here is my particle system:

 let exp = SCNParticleSystem() exp.loops = false exp.birthRate = 5000 exp.emissionDuration = 0.01 exp.spreadingAngle = 180 exp.particleDiesOnCollision = true exp.particleLifeSpan = 0.5 exp.particleLifeSpanVariation = 0.3 exp.particleVelocity = 500 exp.particleVelocityVariation = 3 exp.particleSize = 0.05 exp.stretchFactor = 0.05 exp.particleColor = UIColor.blueColor() scene.addParticleSystem(exp, withTransform: SCNMatrix4MakeRotation(0, 0, 0, 0)) 

Right now, particles are emitting from one point in the center of the text. Is there a way to pin particles to the surface of the text and then start the system to simulate exploding text?

If not, can this be done with any other geometric object, such as a cube?

+5
source share
1 answer

You can specify the shape of the emitter using

 particleSystem.emitterShape = aGeometry; 

and then specify "locationLocation" for SCNParticleBirthLocationSurface or SCNParticleBirthLocationVertex

to emit a surface or vertex of text / cube

+6
source

Source: https://habr.com/ru/post/1200672/


All Articles