2

I have an SKEmitterNode that is acting strange in different versions of iOS. If you look at the screenshot below, you will see that when my scene is loaded, the emitter I am using dumps an odd group of rain drops when the scene first loads.

enter image description here

enter image description here

The strangest part is that this happens in some versions of iOS like 8.1 and 9.2, but in some other versions like 9.0 and 7.0 it runs as expected. (meaning no initial clump of drops, just randomly spaced drops.)

Here is my code in didMoveToView:

 let rainEmitterPath:NSString = NSBundle.mainBundle().pathForResource("homeScreenRain", ofType: "sks")!
    self.rainEmitter01 = NSKeyedUnarchiver.unarchiveObjectWithFile(rainEmitterPath as String) as! SKEmitterNode
    self.rainEmitter01.position = CGPointMake(device.x/2, device.y + 50)
    self.rainEmitter01.targetNode = self
    self.rainEmitter01.particleZPosition = 6.0
    self.rainEmitter01.particleBirthRate = 300
    self.rainEmitter01.particleSpeed = 5000 * worldScale
    self.rainEmitter01.particleSpeedRange = worldScale * 1000
    self.rainEmitter01.particleScale = worldScale
    self.rainEmitter01.particleScaleRange = worldScale
    self.rainEmitter01.particlePositionRange = CGVector(dx: device.x + 100, dy: 5)
    //self.rainEmitter01.advanceSimulationTime(7.0)
    self.addChild(rainEmitter01)

I have tried using the advanceSimulationTime method, but for some reason the group of drops still falls even after the delay.

I have also tried varying the y size of the position range because I figured that my height of 5 was causing this, but nothing changed even when I make the height equal to the size of the screen, and a height of 5 still works in other versions of iOS.

Anyone know why this is happening and a solution/workaround? Thanks in advance.

jwade502
  • 898
  • 1
  • 9
  • 22

0 Answers0