0

I would like to emit a sequence of particles using iOS that move in a circle. All the particles can start near the same location, and should have some variance in their angle/size/etc like with most particle emitters. But I cannot figure out way to get the particles to move in a circular path. I have tried both SKEmitterNode and CAEmitterLayer but neither of these seem to be able to accomplish what I need.

Benr783
  • 2,860
  • 4
  • 20
  • 28
  • 3
    You will have to give more information than that. “Move in a circular path” can be interpreted many ways. What is it that you’re trying to achieve. Can you create an image or something? Can you provide some code that you have tried? Thanks. – Fogmeister Jan 06 '22 at 22:30
  • https://imgur.com/a/W6rH2QE I am interested in the particles being emitted from a central point and then following a circular path – Benr783 Jan 06 '22 at 22:38
  • I think you might be able to do this by creating a layer that will contain the particles. (Not the emitter). Set the emitters target to this new layer. Now rotate the layer. By rotating the layer that contains all the particles the particles will move with circular motion. – Fogmeister Jan 10 '22 at 15:39

1 Answers1

-1

you can create a SKEmitterNode then have it follow a circular path using SKAction.follow(...)

//circle
let diameter:CGFloat = 150
let rect:CGRect = CGRect(x:0, y:0, width:diameter, height:diameter)
let cgMutablePath = CGMutablePath()
cgMutablePath.addEllipse(in: rect)

//particle emitter
let emitter:SKEmitterNode? = SKEmitterNode(fileNamed: "MyParticle.sks") 
emitter?.targetNode = self
emitter?.run(SKAction.follow(cgMutablePath, speed: 200))
self.addChild(emitter ?? SKNode())
Fault
  • 1,115
  • 1
  • 7
  • 11